ASDV-Java/Semester 2/Assignments/lab8_2_CalebFontenot/Printed HTMLs/TestEuropeans.html

102 lines
5.0 KiB
HTML
Raw Normal View History

2023-04-14 01:01:58 -05:00
<!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/caleb/ASDV-Java/Semester 2/Assignments/lab8_2_CalebFontenot/src/main/java/com/calebfontenot/lab8_2_calebfontenot/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.calebfontenot.lab8_2_calebfontenot.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">caleb</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&lt;European&gt; 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">&quot;</span><span class="string">-------------------</span><span class="string">&quot;</span>);
<span class="ST2">testWithArrayOfObjects</span>();
System.<span class="ST3">out</span>.println(<span class="string">&quot;</span><span class="string">-------------------</span><span class="string">&quot;</span>);
<span class="ST2">testWithArrayOfInterfaces</span>();
}
}
</pre></body>
</html>