Using try and catch String input
<p>What I'm doing is asking the user to input a month. I've put in a <code>if</code> and <code>else if</code> to say whether the <strong>month > 12 or month &lt; 1</strong> and re-ask the user to input a month. Im trying to use the try and catch statement to catch the user entering a string and tell them to enter a month. The problem with my code is that when it catches the user entering a string it command line <strong>keeps repeating</strong> the "Please enter a month 1-12" and let user re enter the month . Can anyone stop the problem i'm having trouble with.</p>

<p>I've tried insert the <code>month.scan.nextInt()</code> into the <code>catch</code> but I get an error im really confused. </p>

<pre><code>import java.util.*;
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;

public class Price {
    public static void main(String[] args) {
        userInput();
    }

    public static void userInput() {
        Scanner scan = new Scanner(System.in);

        int month, day, year;
        boolean i = true;
        System.out.println("Please enter a month MM: ");
</code></pre>
