title: Value isn't being brought over
body: <p>So when I enter a value in for the second question my program just stalls and nothing happens. If I enter a value for the first question, then enter a wrong value for the second, then try to cancel out of the program it gives me my display method (which it shouldn't unless the value is allowed).</p>
  
  <p>What's going wrong in my program?</p>
  
  <pre><code>    while (invalidInput) {
          //Try...catch block to find any input errors for the number.
          try {
              finalNum = JOptionPane.showInputDialog(null,
                      "Please enter a number between 1 and 20",
                      "The Word Factory", JOptionPane.QUESTION_MESSAGE);
  
              while (finalNum != null) {
                  finalNumber = Integer.parseInt(finalNum);
                  if (finalNumber &gt; 20 || finalNumber &lt; 1) {
                      JOptionPane.showMessageDialog(null, "The number you entered was not between 1 and 20."
                                      + " \nPlease try again.",
                              "Input Error", JOptionPane.ERROR_MESSAGE);
                      finalNum = JOptionPane.showInputDialog(null,
                              "Please enter a number between 1 and 20",
                              "The Word Factory", JOptionPane.QUESTION_MESSAGE);
  
                      Part2 object = new Part2(finalString, finalNumber);
                      object.answer2 = finalString;
                      object.number2 = finalNumber;
                      object.display();
                  }
              }
              invalidInput = false;
          } catch (NumberFormatException ex) {
              JOptionPane.showMessageDialog(null, "The number you entered was not between 1 and 20."
                              + " \nPlease try again.",
                      "Input Error", JOptionPane.ERROR_MESSAGE);
          }
      }
  </code></pre>