title: What return statement should I utilize in order to use a Menu that throws an exception for non integer values?
body: <p>I am working on a to do list and am currently stuck making a menu. The menu receives input from the user of the numbers 1-6 and carries out a specific task associated with that number(int). That's the perfect world scenario, so I need the menu to be able to take non integer values and not be bricked as well as display an error message to the user. I think I have created an efficient way of asking the user for integers without bricking the program but I cannot determine what my return statement should be in order to utilize the method in the main. I'll use it in a switch statement like this: </p>
  
  <pre><code>         while (true) {
          switch (getMenuOption()) {
              case 1:
              etc
  </code></pre>
  
  <p>This is the current method that I have for the getMenuOption. What return statement should I use, or is there a more efficient way to carry this out?</p>
  
  <pre><code>package project1_martinez_adriel;
  
  import java.util.Scanner;
  
  public class getMenuOption {
      public static int getMenuOption() {    
   Scanner input = new Scanner(System.in);
          System.out.println(" 1. Create a new item \n 2. Mark an item as in progress \n 3. Mark an item as completed \n 4. List all to do items \n 5. Remove completed items \n 6. Exit \n What would you like to do? \n ");
          String value = input.nextLine();
          int num;
          try {
              num = Integer.parseInt(value);
              if (!(num == 1 || num == 2 || num == 3 || num == 4 || num == 5 || num == 6)) {
                  System.out.println("ERROR! Invalid choice! \nPlease enter a valid choice BETWEEN 1 &amp; 6: ");
              }else if (num == 6){
              System.exit(0);
          }
  
  
          } catch (NumberFormatException e) {
              System.out.println("ERROR! Please enter a valid INTEGER between 1 &amp; 6.");
          }
  
          return //What do I put here!?
  
      }
  </code></pre>