Skip to content
Sharp

Collections · interview question

Which Java collection is best suited for iterating over elements in a predictable order using an enhanced for loop?

Multiple choiceEasychapter-4-curatedpremiumcollectionsiteration-and-traversal
Choose one answer
Answer and explanation

Correct answer

B. ArrayList

Why

ArrayList maintains the order of insertion, making it ideal for predictable iteration with an enhanced for loop.

Test yourself on Collections

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

Start free test
All Collections questions →