title: how to handle NumberFormatException in more specific way?
body: <p>I want to handle NumberFormatException in more specific way.
  This exception occurs, when it tries assign anything but an integer, when the following is entered:</p>
  
  <ol>
  <li>string</li>
  <li>character</li>
  <li>empty input</li>
  <li>double number</li>
  </ol>
  
  <p>Depending on what was entered I want to display a proper message, like </p>
  
  <blockquote>
    <p>you've entered string, please enter an integer</p>
  </blockquote>
  
  <p>or </p>
  
  <blockquote>
    <p>value can't be null, please enter an integer value</p>
  </blockquote>
  
  <p>The code below catches <code>NumberFormatException</code> in general way.</p>
  
  <p>I wonder is there a way to include more catch clauses.</p>
  
  <pre><code>    import java.util.Scanner;
  
      public class TestException {
  
          static int input;
          static Scanner scan = new Scanner(System.in);
  
          public static void main(String[] args) {
              System.out.println("Enter an integer number: ");
  
              try {
                  input = Integer.parseInt(scan.next());
                  System.out.println("You've entered number: " + input);
              } catch (NumberFormatException e) {
                  System.out.println("You've entered non-integer number");
                  System.out.println("This caused " + e);
              }
          }
      }
  </code></pre>