Skip to content
Sharp

Core Java · interview question

Which Java collection would you use if you need to store a list of product IDs that allows duplicates and maintains insertion order?

Multiple choiceEasychapter-4-curatedpremiumcore-javacode-reading-with-collections
Choose one answer
Answer and explanation

Correct answer

C. ArrayList

Why

ArrayList maintains the order of insertion and allows duplicate elements, making it suitable for storing a list of product IDs where duplicates are allowed.

Test yourself on Core Java

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

Start free test
All Core Java questions →