Skip to content
Sharp

Collections · interview question

Why do teams use an enhanced for loop over a basic for loop in Java in production code?

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

Correct answer

B. Simpler syntax

Why

The enhanced for loop provides a simpler syntax and is more readable, especially for iterating through collections.

Test yourself on Collections

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

Start free test
All Collections questions →