Java Scanner utility wont allow user to re-enter input in a loop : <p>just trying to wrap my head around Java coding with a few practice programs and am experimenting with loops and the scanner utility and just ran into a problem when trying to use the scanner to check if the right input was entered and getting the program to loop until the right input was entered.</p>

<pre><code>import java.util.Scanner;

public class Calculator {

    public static void main(String[] args) {

        Scanner s = new Scanner(System.in);
        int numbOne;
        boolean checker;

        System.out.println("please enter an Interger");

        do{
            if(s.hasNextInt()){
                numbOne = s.nextInt();
                System.out.println("Yay it worked!!!"); 
                checker = true;
            }
            else{
                System.out.println("I told you to enter an integer you idiot\nTRY AGAIN!!!!!!");
                checker = false;
            }
        }
        while(checker == false);

    }

}
</code></pre>

<p>Basically what is supposed to happen is that once the program enters the loop it asks the user to input an integer, if the user inputs an integer it displays the message "Yay it worked!!!" and breaks out of the loop, however if the user inputs a string or any other value then the code loops around and should ask for the input again.</p>

<p>However the problem I am having is that the program only asks for the input once and if the wrong input is entered then the program just keeps looping the else statement over and over again without asking the user for the input again.</p>

<p>Any idea what I have done wrong?</p>
