title: Execute code when while statement is true, of not user must type in a new input
body: <p>Hello (I'm new to Java and programming). I'm trying to make a while loop . If the user has typed in an integer, execute the code. If the user has not typed in an integer, the user has to type an input untill the input is true.</p>
  
  <p>I tried to do it like this:</p>
  
  <pre><code> Scanner input = new Scanner(System.in);
          System.out.println("Wat is jouw gewicht in kg op aarde?");
          int gewicht = input.nextInt();
  
          while (input.hasNextInt ()) {
  
              System.out.println("Ik heb informatie over de volgende planeten: 1. Venus  2. Mars 3. Jupiter \n 4. Saturn 5. Uranus 6. Neptune");
  
              //Vraag op welke planeet hij wilt boxen
              System.out.println("Op welk planeet ga je boksen?");
              int planeetnummer = input.nextInt();
  
              if (planeetnummer == VENUS) {
                  System.out.println("Jou gewicht op Venus is: " + gewicht * 0.78 + " kg");
              }
  
              if (planeetnummer == MARS) {
                  System.out.println("Jou gewicht op Mars is: " + gewicht * 0.39 + " kg");
              }
  
              if (planeetnummer == JUPITER) {
                  System.out.println("Jou gewicht op Jupiter is: " + gewicht * 2.65 + " kg");
              }
              if (planeetnummer == SATURN) {
                  System.out.println("Jou gewicht op Saturn is: " + gewicht * 1.17 + " kg");
              }
              if (planeetnummer == URANUS) {
                  System.out.println("Jou gewicht op Uranus is: " + gewicht * 1.05 + " kg");
              }
              if (planeetnummer == NEPTUNE) {
                  System.out.println("Jou gewicht op Neptune is: " + gewicht * 1.23 + " kg");
              }
          }
  </code></pre>
  
  <p>So yeh if the user types in an integer it should execute the code and if not the user has to type another input untill its an integer.
  But when I run my code and I type an integer the code is not excecuting and I don't know why? Can anyone help me so this while loop will work?</p>