Java infinite loop
<p>I'm trying to use a <code>while</code> loop to handle user input like so:</p>

<pre><code>while(wordsize == 0) {
    System.out.println("Please enter Int;");
    if (user_input.hasNextInt()) {
        wordsize = user_input.nextInt() ; 
        System.out.println("You have selected " + wordsize + "\n");             
    } else {
        System.out.println("Error Invalid Input!");
    }
}
</code></pre>

<p>However, this loops forever. What I'm trying to do is ask the user to re-enter their data when they enter the wrong details.</p>
