public class Main {
public static void main(String[] args) {
Person harry = new Person();
Person hermione = new Person();
harry.setName("Harry");
hermione.setName("Hermione");
ArrayList<Person> people = new ArrayList<>();
people.add(harry);
people.add(harry.);
people.add(hermione);
Person someone = people.get(1);
someone.setName("Ron");
}
}
Part 1
After the line people.add(hermione), how many distinct objects are there in the people list?
(a) 3 (b) 1 (c) 2 (d) 4 (e) 0
Part 2
After the line people.add(hermione), how many entries are there in the people list? (In other words,
what is the size of the list?)
(a) 4 (b) 0 (c) 1 (d) 2 (e) 3