title: switch block try/catch exception
body: <p>I have a <code>switch</code> statement with 5 integer options and a default message. I am trying to get it to work so that if anything other than the choice numbers is chosen, an "Invalid Input" message will show up. It currently works for numbers, but if anything else is entered, I get the following exception:</p>
  
  <blockquote>
    <p>Exception in thread "main" java.util.InputMismatchException</p>
  </blockquote>
  
  <p>I tried to add a try/catch statement, but it doesn't seem to be working; I keep getting the same error message.</p>
  
  <pre><code>public static void main(String[] args) throws IOException {
      int menuItem = -1;
      while (menuItem != 0) {
          menuItem = menu();
          try {
              switch (menuItem) {
                  case 1:
                      showTaskList();
                      break;
                  case 2:
                      addTask();
                      break;
                  case 3:
                      sortList();
                      break;
                  case 4:
                      deleteTasks();
                      break;
                  case 0:
                      break;
                  default:
                      System.out.println("Invalid Input");
                      break;
              }
          }
          catch (java.util.InputMismatchException err) {
              System.out.println("\nINVALID INPUT!");
          }
      }
  }
  </code></pre>