title: Use of "hasNext()" in Java
body: <pre><code>Scanner input = new Scanner(System.in);
  while(input.hasNext())
  { 
      System.out.println(input.nextInt());
      System.out.println("To go on,Enter any number");    
  }
  </code></pre>
  
  <p>How does <code>hasNext()</code> statement run here? Can anyone explain it detailedly?</p>