Reset author name to chosen name ✨
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>European.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}
|
||||
.ST1 {color: #ffc66d}
|
||||
.comment {color: #808080}
|
||||
.whitespace {color: #505050}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">/home/chloe/ASDV-Java/Semester 2/Assignments/lab8_2_ChloeFontenot/src/main/java/com/chloefontenot/lab8_2_chloefontenot/interfacesGrouped/fun/European.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/Interface.java</span><span class="comment"> to edit this template</span>
|
||||
<span class="comment"> */</span>
|
||||
<span class="literal">package</span> com.chloefontenot.lab8_2_chloefontenot.interfacesGrouped.fun;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">chloe</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">interface</span> European <span class="literal">extends</span> Language, Religion, War {
|
||||
<span class="literal">void</span> <span class="ST1">whatCountry</span>();
|
||||
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
||||
@@ -0,0 +1,67 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>French.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}
|
||||
.string {color: #6a8759}
|
||||
.ST1 {color: #ffc66d}
|
||||
.comment {color: #808080}
|
||||
.whitespace {color: #505050}
|
||||
.ST2 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">/home/chloe/ASDV-Java/Semester 2/Assignments/lab8_2_ChloeFontenot/src/main/java/com/chloefontenot/lab8_2_chloefontenot/interfacesGrouped/fun/French.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/Interface.java</span><span class="comment"> to edit this template</span>
|
||||
<span class="comment"> */</span>
|
||||
<span class="literal">package</span> com.chloefontenot.lab8_2_chloefontenot.interfacesGrouped.fun;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">chloe</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">class</span> French <span class="literal">implements</span> European
|
||||
{
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">whatCountry</span>() {
|
||||
System.<span class="ST2">out</span>.println(<span class="string">"</span><span class="string">+++ I am from France! +++</span><span class="string">"</span>);
|
||||
}
|
||||
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">speakLanguage</span>()
|
||||
{
|
||||
System.<span class="ST2">out</span>.println(<span class="string">"</span><span class="string">speak French</span><span class="string">"</span>);
|
||||
}
|
||||
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">practiceReligion</span>()
|
||||
{
|
||||
System.<span class="ST2">out</span>.println(<span class="string">"</span><span class="string">Roman Catholic</span><span class="string">"</span>);
|
||||
}
|
||||
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">WWI</span>()
|
||||
{
|
||||
System.<span class="ST2">out</span>.println(<span class="string">"</span><span class="string">In WW1 the French won -- Allies!</span><span class="string">"</span>);
|
||||
}
|
||||
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">WWII</span>()
|
||||
{
|
||||
System.<span class="ST2">out</span>.println(<span class="string">"</span><span class="string">In WW2 the French wan -- Allies!</span><span class="string">"</span>);
|
||||
}
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
||||
@@ -0,0 +1,69 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>German.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}
|
||||
.string {color: #6a8759}
|
||||
.ST1 {color: #ffc66d}
|
||||
.comment {color: #808080}
|
||||
.whitespace {color: #505050}
|
||||
.ST2 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">/home/chloe/ASDV-Java/Semester 2/Assignments/lab8_2_ChloeFontenot/src/main/java/com/chloefontenot/lab8_2_chloefontenot/interfacesGrouped/fun/German.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.chloefontenot.lab8_2_chloefontenot.interfacesGrouped.fun;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">chloe</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">class</span> German <span class="literal">implements</span> European {
|
||||
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">whatCountry</span>()
|
||||
{
|
||||
System.<span class="ST2">out</span>.println(<span class="string">"</span><span class="string">+++ I am from Germany! +++</span><span class="string">"</span>);
|
||||
}
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">speakLanguage</span>()
|
||||
{
|
||||
System.<span class="ST2">out</span>.println(<span class="string">"</span><span class="string">speak German</span><span class="string">"</span>);
|
||||
}
|
||||
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">practiceReligion</span>()
|
||||
{
|
||||
System.<span class="ST2">out</span>.println(<span class="string">"</span><span class="string">Protestant</span><span class="string">"</span>);
|
||||
}
|
||||
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">WWI</span>()
|
||||
{
|
||||
System.<span class="ST2">out</span>.println(<span class="string">"</span><span class="string">in WW1 the Germans lost -- Axis!</span><span class="string">"</span>);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">WWII</span>()
|
||||
{
|
||||
System.<span class="ST2">out</span>.println(<span class="string">"</span><span class="string">in WW2 the Germans lost -- Axis!</span><span class="string">"</span>);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
||||
@@ -0,0 +1,35 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Interface1.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}
|
||||
.comment {color: #808080}
|
||||
.whitespace {color: #505050}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">/home/chloe/ASDV-Java/Semester 2/Assignments/lab8_2_ChloeFontenot/src/main/java/com/chloefontenot/lab8_2_chloefontenot/interfacesGrouped/Interface1.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"> * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template</span>
|
||||
<span class="comment"> */</span>
|
||||
<span class="literal">package</span> com.chloefontenot.lab8_2_chloefontenot.interfacesGrouped;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">chloe</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">interface</span> Interface1 {
|
||||
<span class="literal">abstract</span> <span class="literal">void</span> I1();
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
||||
@@ -0,0 +1,35 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Interface2.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}
|
||||
.comment {color: #808080}
|
||||
.whitespace {color: #505050}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">/home/chloe/ASDV-Java/Semester 2/Assignments/lab8_2_ChloeFontenot/src/main/java/com/chloefontenot/lab8_2_chloefontenot/interfacesGrouped/Interface2.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"> * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template</span>
|
||||
<span class="comment"> */</span>
|
||||
<span class="literal">package</span> com.chloefontenot.lab8_2_chloefontenot.interfacesGrouped;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">chloe</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">interface</span> Interface2 {
|
||||
<span class="literal">abstract</span> <span class="literal">void</span> I2();
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>InterfaceGrouped1.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}
|
||||
.number {color: #6897bb}
|
||||
.string {color: #6a8759}
|
||||
.comment {color: #808080}
|
||||
.whitespace {color: #505050}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">/home/chloe/ASDV-Java/Semester 2/Assignments/lab8_2_ChloeFontenot/src/main/java/com/chloefontenot/lab8_2_chloefontenot/interfacesGrouped/InterfaceGrouped1.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"> * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template</span>
|
||||
<span class="comment"> */</span>
|
||||
<span class="literal">package</span> com.chloefontenot.lab8_2_chloefontenot.interfacesGrouped;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">chloe</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">interface</span> InterfaceGrouped1 <span class="literal">extends</span> Interface1, Interface2 {
|
||||
<span class="literal">int</span> x = <span class="number">10</span>; <span class="comment">//public static shared by all who implement or extend the interface</span>
|
||||
<span class="literal">abstract</span> <span class="literal">void</span> IG1();
|
||||
|
||||
<span class="literal">static</span> <span class="literal">void</span> staticMethodOfInterface() {
|
||||
System.out.println(<span class="string">"</span><span class="string">A static method inside an Interface is shared by every class</span><span class="string">"</span> +
|
||||
<span class="string">"</span><span class="string"> that implements Interface InterfaceGrouped1.</span><span class="string">"</span>);
|
||||
}
|
||||
<span class="literal">default</span> <span class="literal">void</span> defaultMethodOfInterface() {
|
||||
System.out.println(<span class="string">"</span><span class="string">The default implementation was used as there was no overriding</span><span class="string">"</span> +
|
||||
<span class="string">"</span><span class="string"> by a class that was implemented the Interface InterfaceGrouped1.</span><span class="string">"</span>);
|
||||
}
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
||||
@@ -0,0 +1,69 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Italian.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}
|
||||
.string {color: #6a8759}
|
||||
.ST1 {color: #ffc66d}
|
||||
.comment {color: #808080}
|
||||
.whitespace {color: #505050}
|
||||
.ST2 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">/home/chloe/ASDV-Java/Semester 2/Assignments/lab8_2_ChloeFontenot/src/main/java/com/chloefontenot/lab8_2_chloefontenot/interfacesGrouped/fun/Italian.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.chloefontenot.lab8_2_chloefontenot.interfacesGrouped.fun;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">chloe</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">class</span> Italian <span class="literal">implements</span> European {
|
||||
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">whatCountry</span>()
|
||||
{
|
||||
System.<span class="ST2">out</span>.println(<span class="string">"</span><span class="string">+++ I am from Itally! +++</span><span class="string">"</span>);
|
||||
}
|
||||
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">speakLanguage</span>()
|
||||
{
|
||||
System.<span class="ST2">out</span>.println(<span class="string">"</span><span class="string">speak Italian</span><span class="string">"</span>);
|
||||
}
|
||||
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">practiceReligion</span>()
|
||||
{
|
||||
System.<span class="ST2">out</span>.println(<span class="string">"</span><span class="string">Roman Catholic</span><span class="string">"</span>);
|
||||
}
|
||||
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">WWI</span>()
|
||||
{
|
||||
System.<span class="ST2">out</span>.println(<span class="string">"</span><span class="string">in WW1 the Italians won -- Allies!</span><span class="string">"</span>);
|
||||
}
|
||||
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">WWII</span>()
|
||||
{
|
||||
System.<span class="ST2">out</span>.println(<span class="string">"</span><span class="string">In WW2 the Italians lost -- Axis!</span><span class="string">"</span>);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
||||
@@ -0,0 +1,35 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Language.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}
|
||||
.comment {color: #808080}
|
||||
.whitespace {color: #505050}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">/home/chloe/ASDV-Java/Semester 2/Assignments/lab8_2_ChloeFontenot/src/main/java/com/chloefontenot/lab8_2_chloefontenot/interfacesGrouped/fun/Language.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"> * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template</span>
|
||||
<span class="comment"> */</span>
|
||||
<span class="literal">package</span> com.chloefontenot.lab8_2_chloefontenot.interfacesGrouped.fun;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">chloe</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">interface</span> Language {
|
||||
<span class="literal">void</span> speakLanguage();
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
||||
@@ -0,0 +1,42 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Religion.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}
|
||||
.string {color: #6a8759}
|
||||
.ST1 {color: #ffc66d}
|
||||
.comment {color: #808080}
|
||||
.whitespace {color: #505050}
|
||||
.ST2 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">/home/chloe/ASDV-Java/Semester 2/Assignments/lab8_2_ChloeFontenot/src/main/java/com/chloefontenot/lab8_2_chloefontenot/interfacesGrouped/fun/Religion.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/Interface.java</span><span class="comment"> to edit this template</span>
|
||||
<span class="comment"> */</span>
|
||||
<span class="literal">package</span> com.chloefontenot.lab8_2_chloefontenot.interfacesGrouped.fun;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">chloe</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">interface</span> Religion {
|
||||
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">practiceReligion</span>();
|
||||
<span class="literal">default</span> <span class="literal">void</span> <span class="ST1">beforeChrist</span>() {
|
||||
System.<span class="ST2">out</span>.println(<span class="string">"</span><span class="string">paganism</span><span class="string">"</span>);
|
||||
}
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
||||
@@ -0,0 +1,69 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Russian.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}
|
||||
.string {color: #6a8759}
|
||||
.ST1 {color: #ffc66d}
|
||||
.comment {color: #808080}
|
||||
.whitespace {color: #505050}
|
||||
.ST2 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">/home/chloe/ASDV-Java/Semester 2/Assignments/lab8_2_ChloeFontenot/src/main/java/com/chloefontenot/lab8_2_chloefontenot/interfacesGrouped/fun/Russian.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.chloefontenot.lab8_2_chloefontenot.interfacesGrouped.fun;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">chloe</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">class</span> Russian <span class="literal">implements</span> European {
|
||||
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">whatCountry</span>()
|
||||
{
|
||||
System.<span class="ST2">out</span>.println(<span class="string">"</span><span class="string">+++ I am from Russia! +++</span><span class="string">"</span>);
|
||||
}
|
||||
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">speakLanguage</span>()
|
||||
{
|
||||
System.<span class="ST2">out</span>.println(<span class="string">"</span><span class="string">speak Russian</span><span class="string">"</span>);
|
||||
}
|
||||
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">practiceReligion</span>()
|
||||
{
|
||||
System.<span class="ST2">out</span>.println(<span class="string">"</span><span class="string">Orthodox</span><span class="string">"</span>);
|
||||
}
|
||||
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">WWI</span>()
|
||||
{
|
||||
System.<span class="ST2">out</span>.println(<span class="string">"</span><span class="string">In WW1 the Russians won -- Allies!</span><span class="string">"</span>);
|
||||
}
|
||||
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">WWII</span>()
|
||||
{
|
||||
System.<span class="ST2">out</span>.println(<span class="string">"</span><span class="string">In WW2 the Russians won -- Allies!</span><span class="string">"</span>);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
||||
@@ -0,0 +1,101 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>TestEuropeans.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}
|
||||
.ST2 {font-family: monospace; font-weight: bold; font-style: italic}
|
||||
.ST0 {color: #287bde}
|
||||
.number {color: #6897bb}
|
||||
.string {color: #6a8759}
|
||||
.comment {color: #808080}
|
||||
.whitespace {color: #505050}
|
||||
.ST1 {color: #ffc66d; font-family: monospace; font-weight: bold; font-style: italic}
|
||||
.ST3 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">/home/chloe/ASDV-Java/Semester 2/Assignments/lab8_2_ChloeFontenot/src/main/java/com/chloefontenot/lab8_2_chloefontenot/interfacesGrouped/fun/TestEuropeans.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.chloefontenot.lab8_2_chloefontenot.interfacesGrouped.fun;
|
||||
|
||||
<span class="literal">import</span> java.util.ArrayList;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">chloe</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">class</span> TestEuropeans {
|
||||
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">testWithArrayList</span>() {
|
||||
ArrayList<European> europeans = <span class="literal">new</span> ArrayList();
|
||||
|
||||
europeans.add(<span class="literal">new</span> French());
|
||||
europeans.add(<span class="literal">new</span> German());
|
||||
europeans.add(<span class="literal">new</span> Russian());
|
||||
europeans.add(<span class="literal">new</span> Italian());
|
||||
|
||||
<span class="literal">for</span> (European man : europeans) {
|
||||
man.whatCountry();
|
||||
man.beforeChrist();
|
||||
man.practiceReligion();
|
||||
man.speakLanguage();
|
||||
man.WWI();
|
||||
man.WWII();
|
||||
}
|
||||
}
|
||||
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">testWithArrayOfObjects</span>() {
|
||||
European[] europeans = {
|
||||
<span class="literal">new</span> French(),
|
||||
<span class="literal">new</span> German(),
|
||||
<span class="literal">new</span> Russian(),
|
||||
<span class="literal">new</span> Italian()
|
||||
};
|
||||
<span class="literal">for</span> (European person : europeans) {
|
||||
person.whatCountry();
|
||||
person.beforeChrist();
|
||||
person.practiceReligion();
|
||||
person.speakLanguage();
|
||||
person.WWI();
|
||||
person.WWII();
|
||||
}
|
||||
}
|
||||
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">testWithArrayOfInterfaces</span>() {
|
||||
European[] europeans = <span class="literal">new</span> European[<span class="number">4</span>];
|
||||
europeans[<span class="number">0</span>] = <span class="literal">new</span> French();
|
||||
europeans[<span class="number">1</span>] = <span class="literal">new</span> German();
|
||||
europeans[<span class="number">2</span>] = <span class="literal">new</span> Russian();
|
||||
europeans[<span class="number">3</span>] = <span class="literal">new</span> Italian();
|
||||
|
||||
<span class="literal">for</span> (European person : europeans) {
|
||||
person.whatCountry();
|
||||
person.beforeChrist();
|
||||
person.practiceReligion();
|
||||
person.speakLanguage();
|
||||
person.WWI();
|
||||
person.WWII();
|
||||
}
|
||||
}
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">main</span>(String[] args) {
|
||||
<span class="ST2">testWithArrayList</span>();
|
||||
System.<span class="ST3">out</span>.println(<span class="string">"</span><span class="string">-------------------</span><span class="string">"</span>);
|
||||
<span class="ST2">testWithArrayOfObjects</span>();
|
||||
System.<span class="ST3">out</span>.println(<span class="string">"</span><span class="string">-------------------</span><span class="string">"</span>);
|
||||
<span class="ST2">testWithArrayOfInterfaces</span>();
|
||||
}
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
||||
@@ -0,0 +1,57 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>TestEuropeansAgain.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}
|
||||
.ST2 {font-family: monospace; font-weight: bold; font-style: italic}
|
||||
.ST0 {color: #287bde}
|
||||
.number {color: #6897bb}
|
||||
.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/chloe/ASDV-Java/Semester 2/Assignments/lab8_2_ChloeFontenot/src/main/java/com/chloefontenot/lab8_2_chloefontenot/interfacesGrouped/fun/TestEuropeansAgain.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.chloefontenot.lab8_2_chloefontenot.interfacesGrouped.fun;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">chloe</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">class</span> TestEuropeansAgain {
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">testWithArrayOfInterfaces</span>() {
|
||||
European[] europeans = <span class="literal">new</span> European[<span class="number">4</span>];
|
||||
europeans[<span class="number">0</span>] = <span class="literal">new</span> French();
|
||||
europeans[<span class="number">1</span>] = <span class="literal">new</span> German();
|
||||
europeans[<span class="number">2</span>] = <span class="literal">new</span> Russian();
|
||||
europeans[<span class="number">3</span>] = <span class="literal">new</span> Italian();
|
||||
|
||||
<span class="literal">for</span> (European person : europeans) {
|
||||
person.whatCountry();
|
||||
person.beforeChrist();
|
||||
person.practiceReligion();
|
||||
person.speakLanguage();
|
||||
person.WWI();
|
||||
person.WWII();
|
||||
}
|
||||
}
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">main</span>(String[] args) {
|
||||
<span class="ST2">testWithArrayOfInterfaces</span>();
|
||||
}
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
||||
@@ -0,0 +1,62 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>TestInterfaces.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/chloe/ASDV-Java/Semester 2/Assignments/lab8_2_ChloeFontenot/src/main/java/com/chloefontenot/lab8_2_chloefontenot/interfacesGrouped/TestInterfaces.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"> * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template</span>
|
||||
<span class="comment"> */</span>
|
||||
<span class="literal">package</span> com.chloefontenot.lab8_2_chloefontenot.interfacesGrouped;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">chloe</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">class</span> TestInterfaces <span class="literal">implements</span> InterfaceGrouped1 {
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> IG1() {
|
||||
System.out.println(<span class="string">"</span><span class="string">TestInterfaces:IG1()</span><span class="string">"</span>);
|
||||
}
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> I1() {
|
||||
System.out.println(<span class="string">"</span><span class="string">TestInterfaces:I1()</span><span class="string">"</span>);
|
||||
}
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> I2() {
|
||||
System.out.println(<span class="string">"</span><span class="string">testInterfaces:I2()</span><span class="string">"</span>);
|
||||
}
|
||||
@Override
|
||||
<span class="literal">public</span> <span class="literal">void</span> defaultMethodOfInterface() {
|
||||
System.out.println(<span class="string">"</span><span class="string">overriden implementation of defaultMethodOfInterface</span><span class="string">"</span>);
|
||||
}
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> main(String[] args)
|
||||
{
|
||||
System.out.println(TestInterfaces.x);
|
||||
|
||||
InterfaceGrouped1.staticMethodOfInterface();
|
||||
TestInterfaces ti = <span class="literal">new</span> TestInterfaces();
|
||||
ti.I1();
|
||||
ti.I2();
|
||||
ti.IG1();
|
||||
ti.defaultMethodOfInterface();
|
||||
}
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
||||
@@ -0,0 +1,38 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>War.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}
|
||||
.ST1 {color: #ffc66d}
|
||||
.comment {color: #808080}
|
||||
.whitespace {color: #505050}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">/home/chloe/ASDV-Java/Semester 2/Assignments/lab8_2_ChloeFontenot/src/main/java/com/chloefontenot/lab8_2_chloefontenot/interfacesGrouped/fun/War.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/Interface.java</span><span class="comment"> to edit this template</span>
|
||||
<span class="comment"> */</span>
|
||||
<span class="literal">package</span> com.chloefontenot.lab8_2_chloefontenot.interfacesGrouped.fun;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">chloe</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">interface</span> War {
|
||||
<span class="literal">void</span> <span class="ST1">WWI</span>();
|
||||
<span class="literal">void</span> <span class="ST1">WWII</span>();
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
||||
BIN
Semester 2/Assignments/lab8_2_ChloeFontenot/labInterfaces2.pdf
Normal file
BIN
Semester 2/Assignments/lab8_2_ChloeFontenot/labInterfaces2.pdf
Normal file
Binary file not shown.
14
Semester 2/Assignments/lab8_2_ChloeFontenot/pom.xml
Normal file
14
Semester 2/Assignments/lab8_2_ChloeFontenot/pom.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.chloefontenot</groupId>
|
||||
<artifactId>lab8_2_ChloeFontenot</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<exec.mainClass>com.chloefontenot.lab8_2_chloefontenot.Lab8_2_ChloeFontenot</exec.mainClass>
|
||||
</properties>
|
||||
</project>
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
*/
|
||||
|
||||
package com.chloefontenot.lab8_2_chloefontenot;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public class Lab8_2_ChloeFontenot {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello World!");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.chloefontenot.lab8_2_chloefontenot;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public class NumberX implements Comparable<NumberX> {
|
||||
int x;
|
||||
public NumberX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
@Override
|
||||
public int compareTo(NumberX o)
|
||||
{
|
||||
if (this.x == o.x) {
|
||||
return 0;
|
||||
} else if (this.x > o.x) {
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
public static void main(String[] args)
|
||||
{
|
||||
NumberX x1 = new NumberX(10);
|
||||
NumberX x2 = new NumberX(20);
|
||||
NumberX x3 = new NumberX(30);
|
||||
System.out.println(x1.compareTo(x2));
|
||||
System.out.println(x1.compareTo(x3));
|
||||
System.out.println(x2.compareTo(x1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "NumberX{" + "x=" + x + '}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.chloefontenot.lab8_2_chloefontenot;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
import java.math.*;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class SortComparableObjects {
|
||||
public static void main(String[] args) {
|
||||
NumberX[] numbers = {new NumberX(20), new NumberX(1), new NumberX(3)};
|
||||
Arrays.sort(numbers);
|
||||
for (NumberX number: numbers) {
|
||||
System.out.println(number);
|
||||
}
|
||||
String[] cities = {"Savannah", "Boston", "Atlanta", "Tampa"};
|
||||
java.util.Arrays.sort(cities);
|
||||
for (String city: cities)
|
||||
System.out.print(city + " ");
|
||||
System.out.println();
|
||||
|
||||
BigInteger[] hugeNumbers = {new BigInteger("2323231092923992"),
|
||||
new BigInteger("432232323239292"),
|
||||
new BigInteger("54623239292")};
|
||||
java.util.Arrays.sort(hugeNumbers);
|
||||
for (BigInteger number: hugeNumbers)
|
||||
System.out.print(number + " ");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
|
||||
*/
|
||||
package com.chloefontenot.lab8_2_chloefontenot.interfacesGrouped;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public interface Interface1 {
|
||||
abstract void I1();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
|
||||
*/
|
||||
package com.chloefontenot.lab8_2_chloefontenot.interfacesGrouped;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public interface Interface2 {
|
||||
abstract void I2();
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
|
||||
*/
|
||||
package com.chloefontenot.lab8_2_chloefontenot.interfacesGrouped;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public interface InterfaceGrouped1 extends Interface1, Interface2 {
|
||||
int x = 10; //public static shared by all who implement or extend the interface
|
||||
abstract void IG1();
|
||||
|
||||
static void staticMethodOfInterface() {
|
||||
System.out.println("A static method inside an Interface is shared by every class" +
|
||||
" that implements Interface InterfaceGrouped1.");
|
||||
}
|
||||
default void defaultMethodOfInterface() {
|
||||
System.out.println("The default implementation was used as there was no overriding" +
|
||||
" by a class that was implemented the Interface InterfaceGrouped1.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.chloefontenot.lab8_2_chloefontenot.interfacesGrouped;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public class TestInterfaces implements InterfaceGrouped1 {
|
||||
@Override
|
||||
public void IG1() {
|
||||
System.out.println("TestInterfaces:IG1()");
|
||||
}
|
||||
@Override
|
||||
public void I1() {
|
||||
System.out.println("TestInterfaces:I1()");
|
||||
}
|
||||
@Override
|
||||
public void I2() {
|
||||
System.out.println("testInterfaces:I2()");
|
||||
}
|
||||
@Override
|
||||
public void defaultMethodOfInterface() {
|
||||
System.out.println("overriden implementation of defaultMethodOfInterface");
|
||||
}
|
||||
public static void main(String[] args)
|
||||
{
|
||||
System.out.println(TestInterfaces.x);
|
||||
|
||||
InterfaceGrouped1.staticMethodOfInterface();
|
||||
TestInterfaces ti = new TestInterfaces();
|
||||
ti.I1();
|
||||
ti.I2();
|
||||
ti.IG1();
|
||||
ti.defaultMethodOfInterface();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
|
||||
*/
|
||||
package com.chloefontenot.lab8_2_chloefontenot.interfacesGrouped.fun;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public interface European extends Language, Religion, War {
|
||||
void whatCountry();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
|
||||
*/
|
||||
package com.chloefontenot.lab8_2_chloefontenot.interfacesGrouped.fun;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public class French implements European
|
||||
{
|
||||
@Override
|
||||
public void whatCountry() {
|
||||
System.out.println("+++ I am from France! +++");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void speakLanguage()
|
||||
{
|
||||
System.out.println("speak French");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void practiceReligion()
|
||||
{
|
||||
System.out.println("Roman Catholic");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void WWI()
|
||||
{
|
||||
System.out.println("In WW1 the French won -- Allies!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void WWII()
|
||||
{
|
||||
System.out.println("In WW2 the French wan -- Allies!");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.chloefontenot.lab8_2_chloefontenot.interfacesGrouped.fun;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public class German implements European {
|
||||
|
||||
@Override
|
||||
public void whatCountry()
|
||||
{
|
||||
System.out.println("+++ I am from Germany! +++");
|
||||
}
|
||||
@Override
|
||||
public void speakLanguage()
|
||||
{
|
||||
System.out.println("speak German");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void practiceReligion()
|
||||
{
|
||||
System.out.println("Protestant");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void WWI()
|
||||
{
|
||||
System.out.println("in WW1 the Germans lost -- Axis!");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void WWII()
|
||||
{
|
||||
System.out.println("in WW2 the Germans lost -- Axis!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.chloefontenot.lab8_2_chloefontenot.interfacesGrouped.fun;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public class Italian implements European {
|
||||
|
||||
@Override
|
||||
public void whatCountry()
|
||||
{
|
||||
System.out.println("+++ I am from Itally! +++");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void speakLanguage()
|
||||
{
|
||||
System.out.println("speak Italian");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void practiceReligion()
|
||||
{
|
||||
System.out.println("Roman Catholic");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void WWI()
|
||||
{
|
||||
System.out.println("in WW1 the Italians won -- Allies!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void WWII()
|
||||
{
|
||||
System.out.println("In WW2 the Italians lost -- Axis!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
|
||||
*/
|
||||
package com.chloefontenot.lab8_2_chloefontenot.interfacesGrouped.fun;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public interface Language {
|
||||
void speakLanguage();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
|
||||
*/
|
||||
package com.chloefontenot.lab8_2_chloefontenot.interfacesGrouped.fun;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public interface Religion {
|
||||
public void practiceReligion();
|
||||
default void beforeChrist() {
|
||||
System.out.println("paganism");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.chloefontenot.lab8_2_chloefontenot.interfacesGrouped.fun;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public class Russian implements European {
|
||||
|
||||
@Override
|
||||
public void whatCountry()
|
||||
{
|
||||
System.out.println("+++ I am from Russia! +++");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void speakLanguage()
|
||||
{
|
||||
System.out.println("speak Russian");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void practiceReligion()
|
||||
{
|
||||
System.out.println("Orthodox");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void WWI()
|
||||
{
|
||||
System.out.println("In WW1 the Russians won -- Allies!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void WWII()
|
||||
{
|
||||
System.out.println("In WW2 the Russians won -- Allies!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.chloefontenot.lab8_2_chloefontenot.interfacesGrouped.fun;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public class TestEuropeans {
|
||||
|
||||
public static void testWithArrayList() {
|
||||
ArrayList<European> europeans = new ArrayList();
|
||||
|
||||
europeans.add(new French());
|
||||
europeans.add(new German());
|
||||
europeans.add(new Russian());
|
||||
europeans.add(new Italian());
|
||||
|
||||
for (European man : europeans) {
|
||||
man.whatCountry();
|
||||
man.beforeChrist();
|
||||
man.practiceReligion();
|
||||
man.speakLanguage();
|
||||
man.WWI();
|
||||
man.WWII();
|
||||
}
|
||||
}
|
||||
|
||||
public static void testWithArrayOfObjects() {
|
||||
European[] europeans = {
|
||||
new French(),
|
||||
new German(),
|
||||
new Russian(),
|
||||
new Italian()
|
||||
};
|
||||
for (European person : europeans) {
|
||||
person.whatCountry();
|
||||
person.beforeChrist();
|
||||
person.practiceReligion();
|
||||
person.speakLanguage();
|
||||
person.WWI();
|
||||
person.WWII();
|
||||
}
|
||||
}
|
||||
|
||||
public static void testWithArrayOfInterfaces() {
|
||||
European[] europeans = new European[4];
|
||||
europeans[0] = new French();
|
||||
europeans[1] = new German();
|
||||
europeans[2] = new Russian();
|
||||
europeans[3] = new Italian();
|
||||
|
||||
for (European person : europeans) {
|
||||
person.whatCountry();
|
||||
person.beforeChrist();
|
||||
person.practiceReligion();
|
||||
person.speakLanguage();
|
||||
person.WWI();
|
||||
person.WWII();
|
||||
}
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
testWithArrayList();
|
||||
System.out.println("-------------------");
|
||||
testWithArrayOfObjects();
|
||||
System.out.println("-------------------");
|
||||
testWithArrayOfInterfaces();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.chloefontenot.lab8_2_chloefontenot.interfacesGrouped.fun;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public class TestEuropeansAgain {
|
||||
public static void testWithArrayOfInterfaces() {
|
||||
European[] europeans = new European[4];
|
||||
europeans[0] = new French();
|
||||
europeans[1] = new German();
|
||||
europeans[2] = new Russian();
|
||||
europeans[3] = new Italian();
|
||||
|
||||
for (European person : europeans) {
|
||||
person.whatCountry();
|
||||
person.beforeChrist();
|
||||
person.practiceReligion();
|
||||
person.speakLanguage();
|
||||
person.WWI();
|
||||
person.WWII();
|
||||
}
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
testWithArrayOfInterfaces();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
|
||||
*/
|
||||
package com.chloefontenot.lab8_2_chloefontenot.interfacesGrouped.fun;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chloe
|
||||
*/
|
||||
public interface War {
|
||||
void WWI();
|
||||
void WWII();
|
||||
}
|
||||
Reference in New Issue
Block a user