title: Returning to a previous menu java
body: <p>so I'm creating this text base game where the user is playing hide and seek with the computer on a map that I have created with different places to search. The dilemma I'm currently having is how to return to a previous menu when the computer isn't in the areas to search. Here is a part of my code where I want to return to the previous menu.</p>
  
  <pre><code>            if(userinput1.equalsIgnoreCase(forrest)){
          System.out.println("You have come to the forrest. There are three paths. Left, Right, or Straight. Where would you like to go?");
          String userinput2 = keyboard.nextLine(); // 3 paths in a forrest
  
          while(!((userinput2.equalsIgnoreCase("left") || userinput2.equalsIgnoreCase("right") || 
          userinput2.equalsIgnoreCase("straight")) )){ // looping for a valid input
              System.out.println("Invalid input. Try again");
              userinput2 = keyboard.nextLine();   
          }
  
          if(userinput2.equalsIgnoreCase("left")){ // the left path in the forrest
              System.out.println("You gone left");
              System.out.println("You come across a tree house. What would you like to do?");
              System.out.println("1:Search the tree house.");
              System.out.println("2:Search the bushes around the tree house");
              System.out.println("3:Return");
              int userInputForrest1 = keyboard.nextInt();
  
              while(!(userInputForrest1 == 1 || userInputForrest1 == 2 || userInputForrest1 == 3)){
                  System.out.println("Invalid input. Try again");
                  System.out.println("1:Search the tree house.");
                  System.out.println("2:Search the bushes around the tree house");
                  System.out.println("3:Return");
                  userInputForrest1 = keyboard.nextInt();
  
              } 
  </code></pre>