So I created three class called "Address", "Job" and "Person" with "Person" being my primary class. I test these by:
Address person2Address = new Address(1054, "Pico St", "Los Angeles", "CA", "97556");
Address person2JobAddress = new Address(5435, "James St", "New York", "NY", "56565");
ArrayList<String> person2Phone = new ArrayList<String>();
person2Phone.add("555-555-55");
Job person2Job = new Job("Mechanic", 35000.00, person2JobAddress);
Person person2 = new Person("Rollan Tico", "New York", 'M', person2Address, person2Job, person2Phone);
System.out.println(person2.toString());
They print everything correctly. Now, this is where I am stuck. How would I create a different class called Persons that stores each Person created in a ArrayList? Would there be any constrcunert? I know that an Arrayist is created by ArrayList<Person> List = new ArrayList<Person>();, but got a feeling I am missing something.
List<Person> persons = Arrays.asList(person1, person2, ...);Arrays.asList()is not immutable, just fixed-size.