Looks like no one added any tags here yet for you.
2D Arrays
Arrays that have rows and columns, forming a grid-like structure.
Array of Arrays
A 2D array
Rows length
The number of rows in a 2D array, accessed using arrayName.length.
Columns length
The length of the first column in a 2D array, accessed using arrayName[0].length.
Indexes
Positions in a 2D array
Initialize a 2D array by elements
int[][] numbers = {{1,2,3,4},{5,6,7,8}};
This would create the two-dimensional array with first row as array [1, 2, 3, 4] and second row as array [5, 6, 7, 8].
Initialize a 2D array by size
int[][] numbers = new int[2][2];
numbers[0][0] = 0;
//...
This would create the two dimensional array with 2 rows and 2 columns. Then you can set the values of individual elements using the row and column index.
How do you access an element of a 2D array?
Use the row index (r), then the column index (c), as shown.
Example: Access element in second row, first column. This would print “5”.
int[][] numbers = {{1,2,3,4},{5,6,7,8}};
System.out.print(numbers[1][0]);
What index does any array start at?
0
What index does an array end at?
array.length - 1