title: Scanner nextInt() and hasNextInt() problems
body: <p>I'm investigating why scan.nextInt() consumes the previous integer from the second iteration onwards. Can anyone make sense of what's going on and also explain what "The scanner does not advance past any input" means exactly?</p>
  
  <p>Please ignore the infinite loop. It's only for testing purposes.</p>
  
  <p>Example:<br>
  Enter new data: 0<br>
  0<br>
  data entered<br>
  Enter data again: 1<br>
  executed<br>
  Enter new data: 1 &lt;- this value is automatically entered (taken from previous input)<br>
  data entered<br>
  Enter data again:</p>
  
  <pre><code>    while(true)
      {
          System.out.print("Enter new data: ");
          System.out.println(scan.nextInt());
          //scan.nextLine();    //must include but I'm not sure why 
          System.out.println("data entered");
          System.out.print("Enter data again: ");
          if(scan.hasNextInt())
          {
              System.out.println("executed");
              //scan.nextLine();    //must include this too but not sure why
          }
      }
  </code></pre>