Source of Infinite Loop
<p>Everytime I run this code, the console goes into an infinite loop printing "Please input a number". I do not understand why this is happening. Thanks in advance.</p>

<pre><code>    boolean check = true;
    int temp = 0;
    while(check==true){
        try{

            temp= asker.nextInt();
            check = false;
        }
        catch(InputMismatchException e){
            System.out.println("Please input a number.");
        }
    }
</code></pre>

<p>Edit: asker is a Scanner. The purpose of the code is to loop until an integer is inputted by the user. </p>
