I know that the problem lies in the command line, but I have tried every which way to find a way to solve it, but I have completely no idea how I can fix the array to not be zero. I am still really new to arrays and have looked everywhere in my textbook on how to do this, but the only example does not include arrays.
here is the error I am getting.
I am using Netbean
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at arraysize.Arraysize.main(Arraysize.java:20)
Here is my code as well
package arraysize;
public class Arraysize {
public static void main(String[] args) {
int[] array = new int[ 10 ];
for ( int counter = 0; counter < array.length; counter++)
array[counter] = Integer.parseInt(args[counter]);
System.out.printf("%s%8s\n", "Index", "Value");
for (int counter = 0; counter < array.length; counter++)
System.out.printf("%5d%8d\n", counter, array[counter]);
}
}