title: Is it possible to check for java.lang.NumberFormatException?
body: <p>Is it possible to check for a <code>NumberFormatException</code> for input string: <code>""</code>? </p>
  
  <p>I tried to write my program so that if the user didn't put in any values an error message would come out instead of NumberFormatException:</p>
  
  <pre><code>if(pasientNavnFelt.getText() == "" || pasientNrFeIt.getText() == "")
  {
    utskriftsområde.setText("ERROR, insert values");
  }
  
  if(pasientNavnFelt.getText() != "" || pasientNrFeIt.getText() != "")
  { 
    // rest of code here if the program had values in it
  }
  </code></pre>
  
  <p>I also tried with null:</p>
  
  <pre><code>if(pasientNavnFelt.getText() == null || pasientNrFeIt.getText() == null)
  {
    utskriftsområde.setText("ERROR, insert values");
  }
  
  if(pasientNavnFelt.getText() != null || pasientNrFeIt.getText() != null)
  { 
    // rest of code here if the program had values in it
  }
  </code></pre>
  
  <p>I still get: </p>
  
  <blockquote>
    <p><code>Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: ""</code></p>
  </blockquote>
  
  <p>The program works fine if it has values.</p>