Skip to content
Sharp

Collections · interview question

Which method of the Iterator interface can potentially throw a NoSuchElementException?

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

Correct answer

D. Next()

Why

The next() method of the Iterator interface throws a NoSuchElementException if there are no more elements in the collection to return.

Test yourself on Collections

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

Start free test
All Collections questions →