I am passing a command line argument using Netbeans but I get an ArrayIndexOutOfBoundsException
.
My code is:
public class CmdLineArgumentPassing
{
public static void main(String args[])
{
System.out.println("Count : " + args.length);
System.out.println("i : "+args[0]);
}
}
The output is:
Count : 0
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
Right mouse click on the project, select Properties, go to the Run page, add the command line arguments.