array index out of bounds error
883540Sep 12 2011 — edited Sep 12 2011I typed up this sample program from a tutorial book:
package nameTest;
public class PrintName {
public static void main(String[] args) {
String firstName = args[0];
String lastName = args[1];
System.out.println(firstName + " " + lastName);
}
}
However, when I try to run it, I get this error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at nameTest.PrintName.main(PrintName.java:6)
This code used to work before I updated to Java 6u26 (my previous version was J2SE 1.5 u6).
Can anyone help me?