The problem I'm running into is that my compiler states that 10 is out of bounds. But how can it be out of bounds if that is the array length i am setting it to?
public class InitArray {
public static void main ( String [] args){
int arrayLength = Integer.parseInt(args[10]); //set array length
int[] array = new int[arrayLength]; /make array
int length = args.length; //the array length to be put in for loop
System.out.printf("%s%8s\n", "Index", "Value");
for( int counter = 0; counter < length; counter++){
System.out.printf("%5d%8d\n", counter, array[counter]);
}
}
}