PersonDemo2.java
1    /* 
2     * PersonDemo1 is a simple program to create and textually display Person 
3     * objects, together with initials and an indication of whether or not the 
4     * person is a baby boomer, but with an Array and a loop 
5     */
6    
7    package people;
8    
9    public class PersonDemo2 {
10   
11       public static void main(String[] args) {
12           Person ka = new Person("Keith Allen",11,22,2002);
13           Person dd= new Person("David Deacon",4,1,1962);
14           Person ds = new Person("Daniel Schlegel",7,14,1980);
15           Person gs = new Person("Giovanni Santiago",8,19,2002);
16           Person ja = new Person("Jenna Allen",12,25,2003);
17           Person tf = new Person("Tracey Fox",5,25,1968);
18   
19           //create and fill array
20           Person[] people = new Person[6];
21           people[0] = ka;
22           people[1] = dd;
23           people[2] = ds;
24           people[3] = gs;
25           people[4] = ja;
26           people[5] = tf;
27   
28           //run through array
29           for(int x = 0; x < people.length; x = x+1) {
30               System.out.println(people[x]);
31           }
32       }
33   }