Code example for NoSuchElementException

0
  public boolean hasMoreElements(){ 
    return false; 
  } 
 
  public Object nextElement(){ 
    throw new NoSuchElementException(); 
  } 
}