your suggestin worked but can't make no sense .. if you point in the direction will be helpfull ..
He explained it pretty clearly. What don't you understand?
Joined: Apr 06, 2013
i am not using IDE .. just text editor .. i meant some theory to help understand the problem.
Stuart A. Burkett
Joined: May 30, 2012
Abid Ramay wrote:i meant some theory to help understand the problem.
The problem was that if you don't pass any command line arguments to a program, the args array that is a parameter to the main method will not contain any values - it will be a zero lenghth array.
On line 13 of the program an attempt was made to access the first element of the array. Because the array has no elements, this isn't possible so the program throws an ArrayIndexOutOfBoundsException.
In general, if an array has size n, you can only access elements with indexes less than n and positive
If you have an array of size 3, you can access elements 0, 1 and 2