How much do you understand about what 2 dimensional arrays are?
You probably know what a 1 dimensional array is. If you had a 1 dimensional array of ints with size 5 and filled with increasing numbers (0-4), we would initialize it with:
int[] array = new int[5];
... (assume we then add 0,1,2,3,4 respectfully) ...
and it would look like this:
{0,1,2,3,4}
There is another way to initialize an array when you know all the index values. That can be done by saying:
int[] array = new int[]{0,1,2,3,4};
This line also creates an array that looks like this:
{0,1,2,3,4}
Now, a 2 dimensional array is very different than a 1 dimensional array. The easiest way of thinking about 2 dimensional arrays is to think of them as a 1 dimensional array, which holds another 1 dimensional array in each of its indexes.
So, if we wanted to create a 2 dimensional array of ints with size 2 by 3, we can imagine it as being the same as creating a 1 dimensional array of size 2, where each index holds 1 dimensional int array of size 3. Here is an example of 3 ways to create, and fill, a 2 dimensional array with the same values. Looking at these 3 ways might help you visualize what a 2 dimensional array looks like:
Way #1:
int[][] array = new int[2][3];
array[0][0] = 0;
array[0][1] = 1;
array[0][2] = 2;
array[1][0] = 3;
array[1][1] = 4;
array[1][2] = 5;
Way #2:
int[][] array = new int[2][3];
int[] subArray1 = new int[3];
subArray1[0] = 0;
subArray1[1] = 1;
subArray1[2] = 2;
array[0] = subArray1;
int[] subArray2 = new int[3];
subArray2[0] = 3;
subArray2[1] = 4;
subArray2[2] = 5;
array[1] = subArray2;
Way #3:
int[][] array = new int[][]{{0,1,2},{3,4,5}};
Now, if that all makes sense to you, then it should also be clear to you that making the call to:
array[0] would return an array of ints, not an int. So in our example, it would return the array: {0,1,2}. However, the call to:
array[0][0] would return just an int (0 in our case), since that statement is effectively saying:
get the first element in the first array.
Does any of that help at all?