title: How do I go back to the main menu from a sub menu using JOptionPane when the user clicks cancel?
body: <p>I'm making a method wherein it has several choices and each of those choices , once selected, need to have the "cancel" button go back to the main menu.</p>
  
  <p>Main Menu:</p>
  
  <pre><code> public static void start(){
     String[] choices = {"1. Routines for Triangles","2. Routines for Temperatures","3. Routines for Geometric Figures","4. String Manipulations",
                                              "5. Miscellaneous Simple Games.","6. Quit"};
     String menu = (String) JOptionPane.showInputDialog(null,"choose","Main menu",JOptionPane.QUESTION_MESSAGE,null,choices,choices[0])
         while (menu != null){
             switch (menu){
                 case "1. Routines for Triangles":
                     triangleRoutines(); //one sub menu
                     break;
                 case "2. Routines for Temperatures":
                     break;
                 case "3. Routines for Geometric Figures":
                     break;
                 case "4. String Manipulations":
                     break;
                 case "5. Miscellaneous Simple Games.":
                     break;
                 case "6. Quit":
                     break;
  
             }
         }
  
     }
  </code></pre>
  
  <p>A sub menu:</p>
  
  <pre><code>private static void triangleRoutines(){
  
     String[] stringArray = {"Determine the Type of Triangle", "Determine a Valid Triangle", "Determine the Area of the Sides of a Triangle", "Determine a Pythagorean Triple",
                              };
         String reply = (String) JOptionPane.showInputDialog(null, "Choose what you want to do today", "Triangle Processes", JOptionPane.QUESTION_MESSAGE,
                 null, stringArray, stringArray[0]);
  
             switch (reply){
                 case "Determine the Type of Triangle":
                     break;
                 case "Determine a Valid Triangle":
                     break;
                 case "Determine the Area of the Sides of a Triangle":
                     break;
                 case "Determine a Pythagorean Triple":
                     break;
             }
   }
  </code></pre>