title: do while loop Java
body: <p>So I am pretty much a newbie to coding and am busy playing around with "do while loops", my code is probably terrible and there are most likely a 1000 better ways to do what I am trying to do but anyways.</p>
  
  <p>I'm trying to use main method and then two other methods (for practice purposes) to ask the user to chose a number between 1 and 10 then if they want to try again.</p>
  
  <p>I get the code to run up until it asks the user to enter yes/no but then the code stops running and i cant figure out why?</p>
  
  <pre><code>public static void main(String[] args) {
      chooseNum();
  
  }
  
  public static boolean chooseNum() {
      int number = 4;
      do {
          System.out.println("Enter a number 1 to 10");
          int userNum = in.nextInt();
          if (number == userNum) {
              System.out.println("You chose the correct number!");
              return tryAgain();
          } else if (number != userNum) {
              System.out.println("You chose the incorrect number!");
              return tryAgain();
          } else
              System.out.println("invalid Response");
      }
      while (false);
      return false;
  }
  
  public static boolean tryAgain(){
  
          System.out.println("Try again? yes/no");
          String response = in.nextLine();
          if (response.equalsIgnoreCase("yes")){
              return chooseNum();
          }else if (response.equalsIgnoreCase("no")){
              return false;
      }else
          return false;
      }
  }
  </code></pre>
  
  <p>and my output is as follows:</p>
  
  <pre><code>Enter a number 1 to 10
  1
  You chose the incorrect number!
  Try again? yes/no
  
  Process finished with exit code 0
  </code></pre>
  
  <p>I cant seem to get it any further in order for me to input yes or no.</p>
  
  <p>I know this is basic and I most likely look pathetic but any help will be appreciated. </p>
  
  <p>Maybe another rookie can get their chance at helping someone out:)</p>
  
  <p>Thanks a lot!</p>