-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmployeeTester.java
More file actions
26 lines (23 loc) · 1.04 KB
/
EmployeeTester.java
File metadata and controls
26 lines (23 loc) · 1.04 KB
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
import java.util.Arrays; // for sorting (depends on compareTo)
public class EmployeeTester
{
public static void main ( String[] args )
{
Employee[] workers = new Employee[12];
workers[0] = new Employee( "Fred", "Adams", 1963);
workers[1] = new Employee( "John", "Adams", 1959);
workers[2] = new Employee( "Elmer", "Adams", 1976);
workers[3] = new Employee( "Nancy", "Devon", 1963);
workers[4] = new Employee( "Andrew", "Lewis", 1983);
workers[5] = new Employee( "Douglas", "Page", 1981);
workers[6] = new Employee( "Donald", "Wolder", 1963);
workers[7] = new Employee( "Henry", "Wolder", 1972);
workers[8] = new Employee( "Robert", "Wolder", 1959);
workers[9] = new Employee( "Howard", "Cohen", 1933);
workers[10] = new Employee( "Howard", "Cohen", 1958);
workers[11] = new Employee( "Donald", "Rice", 1935);
Arrays.sort( workers ); //only works if argument is "Comparable"!
for ( Employee emp : workers )
System.out.println( emp );
}
}