title: Why isn't the try and catch working?
body: <p>I'm trying to make a program that tells the person if they can ride a roller coaster or not. It works as long as the input is valid, but I want it to show a message saying to retry if the user inputs something else. I tried using try and catch, but it still shows an error (NumberFormat Exception). Any help is appreciated, thanks.</p>
  
  <pre><code>private void btnCalculateActionPerformed(java.awt.event.ActionEvent evt) {                                             
      String strHeight, strBackTrouble, strHeartTrouble;
      int intHeight;
  
      strHeight = txtInputHeight.getText();
      strBackTrouble = txtInputBackTrouble.getText();
      strHeartTrouble = txtInputHeartTrouble.getText();
  
      intHeight = Integer.parseInt(strHeight);
  
      try {
          if (intHeight &lt; 188 || intHeight &gt; 122) {
              if (strBackTrouble.equals("N") || strBackTrouble.equals("n") || strHeartTrouble.equals("N") || strHeartTrouble.equals("n")) {
                      txtOutput.setText("It is OK for you to ride this roller coaster. Have fun!");
              }
          } else  if (strBackTrouble.equals("Y") || strBackTrouble.equals("y") || strHeartTrouble.equals("Y") || strHeartTrouble.equals("y")) {
                  txtOutput.setText("Sorry, it is not safe for you to ride this rollercoaster");
              }
  
      } catch (Exception e) {
          txtOutput.setText("You entered invalid input, please try again");
      }
  
  }                 
  </code></pre>