Answered step by step
Verified Expert Solution
Link Copied!

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)

image text in transcribed
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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions