Skip to content
Sharp

Collections · interview question

Which method of the Iterator interface is used to check if there are more elements?

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

Correct answer

D. HasNext()

Why

The hasNext() method returns true if the iteration has more elements, allowing safe calls to next().

Test yourself on Collections

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

Start free test
All Collections questions →