Question: 18. Write a declaration for a new ArrayList of Person objects, called students. Initialise the new ArrayList. Note: you may leave it empty. (2 marks)
18. Write a declaration for a new ArrayList of Person objects, called students. Initialise the new ArrayList. Note: you may leave it empty. (2 marks) 19. What sort of loop is most commonly used to iterate through collections? (1 mark) If the Person class in Q18 has a method called "printName" that takes no parameters, and returns a String, write a loop that will print out all the students' names, one per line. (2 marks)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
