Skip to content
Sharp

Object-oriented programming · interview question

If a 'Customer' class needs to track multiple shipping addresses, which design is most appropriate?

Multiple choiceHardchapter-2-curatedpremiumoopbasic-modeling
Choose one answer
Answer and explanation

Correct answer

C. Add an ArrayList of Address objects to Customer

Why

Using an ArrayList of Address objects allows a Customer to maintain multiple addresses flexibly, adhering to OOP principles by separating address logic from customer logic.

Test yourself on Object-oriented programming

A free test with instant, explained results. No account needed.

Start free test
All Object-oriented programming questions →