<<< Elements of a two-dimensional array | Index | Two-dimensional array examples >>> |
Statement
int[][] matrix = new int[20][15];
declares and instantiates a two-dimensional array matrix of 20 rows and 15 columns
Each row of matrix is a one-dimensional array:
matrix.length // returns 20, the number of rows matrix[0] // refers to the first row matrix[0].length // returns 15, the number of columns in the first row matrix[1].length // returns 15, the number of columns in the second row matrix[2].length // and so on.
<<< Elements of a two-dimensional array | Index | Two-dimensional array examples >>> |