/home/caleb/ASDV-Java/Semester 2/Assignments/lab8_2_CalebFontenot/src/main/java/com/calebfontenot/lab8_2_calebfontenot/interfacesGrouped/fun/TestEuropeans.java |
nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
package com.calebfontenot.lab8_2_calebfontenot.interfacesGrouped.fun;
import java.util.ArrayList;
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();
}
}