Try catch loops
<p>I am not asking anyone to do my work I just need a little help solving this mismatch. This is my program:</p>

<pre><code>import java.util.InputMismatchException;
import java.util.Scanner;
class FibonacciNumbers {

    FibonacciNumbers()          //default constructor
    {
    }

    Scanner in = new Scanner(System.in);

    public int fOf(int n)
    {

        if (n == 0)                        //the base case
        {

            return 0;

        }
        else if (n==1)
        {

            return 1;
        }

        else 
        {

           return fOf(n-1)+fOf(n-2); 
        }
        }

 public static void main(String[] args)
    {
       FibonacciNumbers fNumbers = new FibonacciNumbers();    //creates new object

        Scanner in = new Scanner(System.in);
        String userInput;
         int n = 0;
        boolean IsRepeat = true ;  
        boolean isQuit; 
        boolean checkException = false;

     isQuit = false;  

     while (!isQuit) 
     {


try {

    {

        System.out.print("Enter the number you want to convert to Fibanocci('q' to quit): ");


        n = in.nextInt();
        System.out.print("The Fibanocci number for "+n+" is: ");
        n = fNumbers.fOf(n);
        System.out.println(n);

        System.out.print("Do you want to run again? Press 'N' for No or anything else to continue: ");  

        userInput = in.next();  

       if(userInput.equalsIgnoreCase("N") )
          {  
              isQuit = true;
              System.out.println("Good-bye!"); 
           }  
        else 

         {  
        IsRepeat = true; 
         }
       }
    }

catch(InputMismatchException ex) {  
          userInput = in.nextLine();  

           if  ((userInput.charAt(0) == 'q') || (userInput.charAt(0) == 'Q') )  
             {  

                  isQuit = true; 
                  System.out.println("Good-bye!");  

             }  

           else {  
                 checkException = true;
                 IsRepeat = true;
                 System.out.println("Invalid entry, Try again!");
              }    
    }

    catch (ArrayIndexOutOfBoundsException a)
         {
            n = in.nextInt();
             if  (n&lt;0 || n&gt;46) 
                        {
                            System.out.println("Invalid entry! Please enter an integer that is greater than 0 but less than 46 :");
                            checkException = false;//sets boolean value to false, continues the loop


                        }
                      else
                          {
                            IsRepeat = true;   
                          }
    }
    }
}
}
</code></pre>

<p>I did everything I got everything to work but at this part it is not going as I want it to run:</p>

<pre><code>catch (ArrayIndexOutOfBoundsException a)
         {
            n = in.nextInt();
             if  (n&lt;0 || n&gt;46) 
                        {
                            System.out.println("Invalid entry! Please enter an integer that is greater than 0 but less than 46 :");
                            checkException = false;//sets boolean value to false, continues the loop


                        }
                      else
                          {
                            IsRepeat = true;   
                          }
    }
</code></pre>

<p>When I run it if the user inputs higher than 46 or lower than 0 then ask them for a different input but it is just doing the math. It wont do as i wrote the program.</p>
