ArrayElementTypeRepeats
DRAFT

Misconception:

When writing out the type of a multi-dimensional array or allocating a multi-dimensional array, the element type is written once for each dimension (e.g., int[] int[] a = new int[2] int[3] for a two-by-three array of ints).

Incorrect

The type of a multi-dimensional array is written as T[] T[] T[]

Correct

The type of a multi-dimensional array is written as T[][][]

Correction
Here is what's right.

The innermost element type is written only once.

For example:

int[][] means an array of arrays of ints.

new double[3][2][1] allocates a three-dimensional array of doubles (or, more precisely, an array of arrays of arrays of doubles).

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.