56 lines
4.0 KiB
HTML
56 lines
4.0 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
<html>
|
|
<head>
|
|
<title>A.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}
|
|
.string {color: #6a8759}
|
|
.comment {color: #808080}
|
|
.whitespace {color: #505050}
|
|
-->
|
|
</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/A.java</td></tr></table>
|
|
<pre>
|
|
<span class="comment">/*</span>
|
|
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license</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> A {
|
|
<span class="literal">public</span> A() { System.out.println(<span class="string">"</span><span class="string">A constructor was called</span><span class="string">"</span>); }
|
|
<span class="literal">public</span> A(String msg) {System.out.println(msg);}
|
|
<span class="literal">public</span> A(String msg1, String msg2) {
|
|
<span class="literal">this</span> (msg1 + <span class="string">"</span><span class="string">; </span><span class="string">"</span> + msg2);
|
|
System.out.println(<span class="string">"</span><span class="string">A 2-parm constructor was called</span><span class="string">"</span>);
|
|
}
|
|
<span class="literal">public</span> <span class="literal">void</span> instanceMethod1() { System.out.println(<span class="string">"</span><span class="string">Instance method1 called from A</span><span class="string">"</span>); }
|
|
<span class="literal">public</span> <span class="literal">void</span> instanceMethod2() { System.out.println(<span class="string">"</span><span class="string">Instance method2 called from A</span><span class="string">"</span>); }
|
|
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> staticMethod() {System.out.println(<span class="string">"</span><span class="string">Static method 2 called from A</span><span class="string">"</span>); }
|
|
}
|
|
|
|
<span class="literal">class</span> B <span class="literal">extends</span> A {
|
|
<span class="literal">public</span> B() {System.out.println(<span class="string">"</span><span class="string">B constructor called</span><span class="string">"</span>);}
|
|
<span class="literal">public</span> B(String msg)
|
|
{
|
|
System.out.println(<span class="string">"</span><span class="string">B constructor called</span><span class="string">"</span>);
|
|
System.out.println(msg);
|
|
}
|
|
<span class="literal">public</span> <span class="literal">void</span> instanceMethod1() { System.out.println(<span class="string">"</span><span class="string">Instance method1 called from B</span><span class="string">"</span>); }
|
|
<span class="literal">public</span> <span class="literal">void</span> instanceMethod2() { System.out.println(<span class="string">"</span><span class="string">Instance method2 called from B</span><span class="string">"</span>); }
|
|
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> staticMethod() {System.out.println(<span class="string">"</span><span class="string">Static method 2 called from B</span><span class="string">"</span>); }
|
|
}
|
|
|
|
</pre></body>
|
|
</html>
|