What happens if next() is called on an Iterator when there are no more elements?

Last Updated :
Discuss
Comments

What happens if next() is called on an Iterator when there are no more elements?


It returns null

It resets the iterator

It throws a NoSuchElementException

It stops the iteration silently


Share your thoughts in the comments