Multiple choice

Which of the following methods of Iterator class throws NoSuchElementException, if the next element does not exist?

  1. hasNext()

  2. next()

  3. remove()

  4. add()

  5. nextIndex()

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

This method of Iterator class throws NoSuchElementException, if there is not a next element.