title: While Loop with hasNextInt() actually reading?
body: <p>Hello my problem is with this program.</p>
  
  <pre><code>int integer = 0;
  int evenInts = 0;
  Scanner in = new Scanner(System.in);
  System.out.print("Enter an integer: ");
  integer = in.nextInt();
  while(in.hasNextInt()){
       System.out.print("Enter an integer: ");
       integer = in.nextInt(); }
  </code></pre>
  
  <p>It should read in an int after "Enter an integer: " is asked. After that as long as integers are put in the input this procedure gets repeated.
  Actually it prints something like this :</p>
  
  <pre><code>Enter an integer: 10
  10 // so basically the 
  </code></pre>
  
  <blockquote>
    <p>"Enter an integer: "</p>
  </blockquote>
  
  <p>message does not get printed this time    </p>
  
  <blockquote>
    <p>Enter an integer: 12</p>
  </blockquote>
  
  <p>If I leave away the <code>integer = in.nextInt();</code> code part before the while loop everything works fine. Why does the program behave like this? Is it because of buffering or a logical error.</p>
  
  <p>Thanks!</p>