ArrayRankIsLengthDRAFT
The number of elements in an array is the same as the number of dimensions of an array.
Array rank and array length are the same thing
Array rank and array length are different concepts
CorrectionHere is what's right.
Rank and length are two different concepts. The rank of an array corresponds to the number of dimensions of that array.
An array can have one or more dimensions. An array of rank one is a one-dimensional array; it can have any number of elements (in Java, between 0 and about about 2 billion).
An array of rank two is a two-dimensional array; in Java this really is an outer array which contains inner subarrays as elements. A two-dimensional array is made up of an outer array of a given length (between 0 and about 2 billion elements), and each element can point to an inner subarray of a given length (between 0 and about 2 billion elements). In fact, the different inner subarrays can have different lengths. The special case of a two-dimensional array where all inner subarrays are of the same length is called a “rectangular” array:
int[][] a = new int[10][20];
The above array has two dimensions (indicated by the two bracket-pairs). Thus it is an array of rank two, or a two-dimensional array. The outer dimension has 10 elements. The inner dimension has 20 elements (each inner subarray has length 20; the overall array is “rectangular”).