title: Java Error "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException"
body: <p>Here is this simple code from my book it produces error message in netbeans and in compile version (.class) version running through Command prompt.</p>
  
  <p>Error Message</p>
  
  <pre><code>Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
      at intocm.Intocm.main(Intocm.java:17)
  </code></pre>
  
  <p>Simple Program to convert inches to centimeter.</p>
  
  <pre><code>package intocm;
  
  public class Intocm {
  
      public static void main(String[] args) {
          // TODO code application logic here
          double inches;
          inches = Double.valueOf(args[0]).doubleValue();
          double cm;
          cm = inches * 2.54;
          System.out.println(cm + "Centimeters");
      }
  }
  </code></pre>
  
  <p>The Line which Causes error is</p>
  
  <pre><code>inches = Double.valueOf(args[0]).doubleValue();
  </code></pre>
  
  <p>I don't know why this array "args" causing this error please help me in understanding this.</p>
  
  <p>Thank you.</p>