PersonDemo2.java
1    /* 
2    * PersonDemo2 is a simple program to create and textually display a Person 
3     * objects, together with initials and indication of whether or not the 
4     * person is a baby boomer. The only difference is that all of the data will 
5     * be stored in an array. 
6     */
7    package people;
8    
9    public class PersonDemo2 {
10   
11       public static void main(String[] args) {
12           //CREATE AN ARRAY OF PERSON OBJECT OF SIZE 6 AND FILL IT WITH DATA
13           Person bd = new Person("Bob Dylan",5,24,1941);
14           Person nr = new Person("Noomi Rapace", 12, 28, 1974);
15           Person pw = new Person("Pharrel Williams",4,5,1973);
16           Person fs = new Person("Frank Sinatra",12,12,1915);
17           Person dk = new Person("Diana Krall",11,16,1964);
18           Person ak = new Person("Aiden Kenyon",10,12,2000);
19   
20           Person[] people = new Person[6];
21           people[0] = bd;
22           people[1] = nr;
23           people[2] = pw;
24           people[3] = fs;
25           people[4] = dk;
26           people[5] = ak;
27   
28           //USE FOR LOOP TO DISPLAY THE SIX PERSON OBJECTS IN THEIR TEXTUAL FORM
29           for (int i = 0; i < people.length; i = i + 1) {
30               System.out.println(people[i].toString());
31           }
32       }
33   
34   }
35