63 lines
3.2 KiB
HTML
63 lines
3.2 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||
|
<html>
|
||
|
<head>
|
||
|
<title>lab5_CalebFontenot.java</title>
|
||
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||
|
<style type="text/css">
|
||
|
<!--
|
||
|
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
|
||
|
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
|
||
|
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
|
||
|
.literal {color: #cc7832}
|
||
|
.ST0 {color: #287bde}
|
||
|
.comment {color: #808080}
|
||
|
.whitespace {color: #505050}
|
||
|
.ST1 {color: #ffc66d; font-family: monospace; font-weight: bold; font-style: italic}
|
||
|
-->
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/lab5_CalebFontenot.java</td></tr></table>
|
||
|
<pre>
|
||
|
<span class="comment">/*</span>
|
||
|
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt</span><span class="comment"> to change this license</span>
|
||
|
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java</span><span class="comment"> to edit this template</span>
|
||
|
<span class="comment"> */</span>
|
||
|
<span class="literal">package</span> com.calebfontenot.lab5_calebfontenot;
|
||
|
|
||
|
<span class="comment">/**</span>
|
||
|
<span class="comment"> *</span>
|
||
|
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">caleb</span>
|
||
|
<span class="comment">*/</span>
|
||
|
<span class="literal">public</span> <span class="literal">class</span> lab5_CalebFontenot {
|
||
|
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">main</span>(String[] args)
|
||
|
{
|
||
|
<span class="comment">//B b = new B("hi");</span>
|
||
|
<span class="comment">//A a = new A("msg1: The 2-parm constructor of A uses \"this\"",</span>
|
||
|
<span class="comment">// "msg2: to call the 1-parm constructor of A ");</span>
|
||
|
<span class="comment">//A a1 = new A();</span>
|
||
|
<span class="comment">//B b1 = new B();</span>
|
||
|
<span class="comment">//a.instanceMethod1();</span>
|
||
|
<span class="comment">//a.instanceMethod2();</span>
|
||
|
<span class="comment">//A.staticMethod();</span>
|
||
|
|
||
|
<span class="comment">//b.instanceMethod1();</span>
|
||
|
<span class="comment">//b.instanceMethod2();</span>
|
||
|
<span class="comment">//B.staticMethod();</span>
|
||
|
|
||
|
<span class="comment">//A a3 = new B();</span>
|
||
|
<span class="comment">//a3.instanceMethod1();</span>
|
||
|
|
||
|
<span class="comment">//testPolymorphism(a1);</span>
|
||
|
<span class="comment">//testPolymorphism(b1);</span>
|
||
|
|
||
|
B <span class="comment">b2</span> = (B) <span class="literal">new</span> A();
|
||
|
}
|
||
|
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">testPolymorphism</span>(A a) {
|
||
|
a.instanceMethod1();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
</pre></body>
|
||
|
</html>
|