title: Try catch with containing for and if statement Java
body: <p>I am having an issue with my program.  The user is able to enter a grade into a GUI, but the grade has to be within grade 9 to 12.<br>
  This is what I've tried so far, but it doesn't seem to work. </p>
  
  <pre><code>int grade = Integer.parseInt(inputGrade.getText());
  else
      {
          try
          {
              for (int i = 9; i &lt; 13; i++)
              {
                  if (grade == i)
                  {
                  grade = Integer.parseInt(inputGrade.getText());
                  }
              } 
          }
  
          catch(NumberFormatException e)
          {            
              for (int x = -1; x &lt; 9; x++)
              {
                  if (grade == x)
                  {
                  outputHint.setText("Grade not valid");
                  }
              }
          }
  </code></pre>
  
  <p>There is no hint being outputted.  </p>
  
  <p>Any help please?
  Thanks in advance!!</p>