Java - looping in try-catch block
<p>I am working on writing a file reader, and the idea is to have the user enter a number that represents the line number from the text file.  The variable that holds this number is of type <code>int</code>. However, when the user enters a <code>String</code> instead, Java throws the <code>InputMismatchException</code> exception, and what I want is to have a loop in the <code>catch</code> clause, where I will be looping until the user enters a valid value, i.e. an <code>int</code>.  The skeleton looks like this:    </p>

<pre><code> public void _____ throws IOException {
    try {
    // Prompting user for line number
    // Getting number from keyboard
    // Do something with number
    } catch (InputMismatchException e) {
       // I want to loop until the user enters a valid input
       // When the above step is achieved, I am invoking another method here
    }  
}
</code></pre>

<p>My question is, what are some possible techniques that could do the validation? 
Thank you.</p>
