PersonDemo2.java
1    package people;
2    
3    
4    public class PersonDemo2 {
5    
6        public static void main(String[] args) {
7    
8            //Introducing the objects
9            Person bd = new Person ("Bob", "Dylan", 5,24,1941);
10           Person nr = new Person ("Noomi", "Rapace", 12,28,1974);
11           Person pw = new Person ("Pharrell", "Williams", 4,5,1973);
12           Person fs = new Person ("Frank", "Sinatra", 12,12,1915);
13           Person dk = new Person ("Diana", "Krall", 11,16,1964);
14           Person ar = new Person ("Alexander", "Robinson", 7,19,2001);
15   
16           //Declaring the Array using the Person Class
17           Person[] people = new Person[6];
18           //Adding objects to the Array
19           people[0] = bd;
20           people[1] = nr;
21           people[2] = pw;
22           people[3] = fs;
23           people[4] = dk;
24           people[5] = ar;
25           //Printing objects in the Array
26           for (int i = 0; i < people.length; i++) {
27               System.out.println(people[i]);
28           }
29       }
30   }
31