-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest5Main.java
More file actions
27 lines (18 loc) · 839 Bytes
/
Test5Main.java
File metadata and controls
27 lines (18 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package people;
import java.util.*;
public class Test5Main {
// Method prints all the people in the parameter list.
public static void printDepartment(List<Person> people) {
for (Person person : people) {
// For each person in the list, print out the default toString
System.out.println(person);
}
}
public static void main (String[] args) {
List<Person> people = new ArrayList<Person>();
people.add( new Teacher("Pekka Mikkola", "Korsontie Street 1 03100 Vantaa", 1200) );
people.add( new Student("Olli", "Ida Albergintie Street 1 00400 Helsinki") );
people.add( new Teacher("Esko Ukkonen", "Mannerheimintie 15 Street 00100 Helsinki", 5400) );
printDepartment(people);
}
}