title: ArrayIndexOutOfBoundsException in arguments array
body: <p>Input file: file1.cmd</p>
  
  <pre><code>A = 7
  B = 8
  </code></pre>
  
  <p>CODE</p>
  
  <pre><code>import java.util.Scanner;
  import java.util.Map;
  import java.util.HashMap;
  
  public class Commander
  {
      public static void main(String[] args)
      {
          Map&lt;String,Integer&gt; expression = new HashMap&lt;String,Integer&gt;();
  
          Scanner sc = new Scanner(System.in);
          String Variable, assignmentOperator;
          int Value, i = 0;
  
          while(true)
          {
              args[i] = sc.nextLine();
              args[i + 1] = sc.nextLine();
              args[i + 2] = sc.nextLine();
  
              expression.put(args[i],Integer.parseInt(args[i + 2]));
  
              for(String key: expression.keySet())
                  System.out.println(key + " - " + expression.get(key));
  
              if(!sc.hasNextLine()) break;
  
              ++i;
  
          }
      }
  }
  </code></pre>
  
  <p>I am getting the following error:</p>
  
  <pre><code>    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
      at Commander.main(Commander.java:17)
  </code></pre>
  
  <p>I am having difficulty in resolving this error, any help is appreciated. According to my cmd file, A is args[0], = is args[1] and 7 is args[2], then a new line is started in which B is the new value of args[0] ? I am confused.</p>