1 /* 2 * PersonDemo2 is a simple program to create and textually display Person objects, 3 * and an indication of whether or not the person is a Baby Boomer. 4 * This one uses an array and a for loop to loop through it. 5 */ 6 package people; 7 8 public class PersonDemo2 { 9 10 public static void main(String[] args) { 11 12 //Create the six Person objects 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("Pharrell 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 jk = new Person("James Kuntz", 1,31,1990); 19 20 //Create an array of Person objects of size 6 and fill it with the data. 21 Person[] people = new Person[6]; 22 people[0] = bd; 23 people[1] = nr; 24 people[2] = pw; 25 people[3] = fs; 26 people[4] = dk; 27 people[5] = jk; 28 29 //Display the six Person objects to the standard output stream 30 for (int i = 0; i < people.length; i++) { 31 System.out.println(people[i].toString()); 32 } 33 } 34 } 35