title: String and Null Exception check through Try and Catch Block
body: <p>The following code to try to catch a empity double inputvia logging is not working. I also want to check if a user added a string in the input field by mistake (but I am having trouble writing the query). Can someone please look at this and guide me.</p>
  
  <pre><code>try {
      if (results1 != 00.00) {
          throw new Exception("Data must be added");
      }
  }
  catch (Exception e) {  
      log.error("You have an error", e);
  }  
  </code></pre>
  
  <p>The user must enter a value for results1 as it is used for a calculation. Results1 is a double as it is a percentage, I am willing to change it to an int if thats what it takes to make it work. I also want to check through the try and catch technique if a user accidently added a % sign. I want my logger to catche the NumberFormatException for testing purposes.</p>
  
  <p>I think this might be the problem:</p>
  
  <pre><code>      (results1 != 00.00)
  </code></pre>
  
  <p>Is this the best way to check if the input is empty for a double. Also How can i check if a string is added?</p>