Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started