January 2014
Intermediate to advanced
736 pages
70h 43m
English
A multidimensional array with the same number of columns in every row can be created with an array-creation expression. For example, the following lines declare array b and assign it a reference to a three-by-four array:
int[][] b = new int[ 3 ][ 4 ];
In this case, we use the literal values 3 and 4 to specify the number of rows and number of columns, respectively, but this is not required. Programs can also use variables to specify array dimensions, because new creates arrays at execution time—not at compile time. As with one-dimensional arrays, the elements of a multidimensional array are initialized when the array object is created.
A multidimensional ...
Read now
Unlock full access