title: How to print when NumberFormatException occurs?
body: <p>How do I print something when a command line argument is not an integer and a <code>NumberFormatException</code> occurs?</p>
  
  <p>My program takes 3 command line arguments and prints certain text depending on what they are. </p>
  
  <p>Here's the code:</p>
  
  <pre><code>    public class CommandLine {
  
    public static void main(String[] args) {
  
        if(args.length !=3){
            System.out.println("Error. Must give 3 values");
          }
       int x = Integer.parseInt(args[0]);
       int y = Integer.parseInt(args[1]);
       int z = Integer.parseInt(args[2]);
  
       if((x%2)==0 &amp;&amp; (y%2)==0 &amp;&amp;(z%2)==0)
       System.out.println("Even");
  
  else
      System.out.println("odd");
  
    }
  
  }
  </code></pre>