This exception extends the RuntimeException class and thus, belongs to those exceptions that can be thrown during the operation of the Java Virtual Machine (JVM) . It is an unchecked exception and thus, it does not need to be declared in a method’s or a constructor’s throws clause. The NoSuchElementException in Java The NoSuchElementException can be thrown by the following methods : Enumeration::nextElement() NamingEnumeration::next() StringTokenizer::nextElement() Iterator::next() All the aforementioned methods try to return the next element of an enumeration and throw that exception, in order to indicate that no more elements exist. example- import java . util . HashSet ; import java . util . Hashtable ; import java . util . Set ; import java . util . StringTokenizer ; public class NoSuchElementExceptionExample { public static void main ( String [] args ) { Set sampleSet = new HashSet (); Hashtable sampleTable =