To create an length 5 int array, we use the syntax:
int[] x = new int[5]
To create a 2 dimensional array, an array of int arrays, we say:
int[][] x = new int[5][];
This creates an array of length 5, which can hold int[] objects.
For this second case, why isn’t the syntax this: ?
int[][] x = new int[][5]
After all, 5 defines how many int arrays we can have. Not the size of the int arrays that we’re going to put into x.
It would be really weird to have the indices for lookups be different from the indices for construction. So if you had
int[][] x= new int[][5], then you’d look up the elements withx[0..4][foo], which is just more confusing than the alternative.