Arrays Can Be Jagged
In languages like C and C++, each subarray of a multidimensional array must have the same dimensions.
在C和C++語言中,多元數組的子數組必須要有相同的維數。
In Java and C# arrays do not have to be uniform because jagged arrays can be created as one-dimensional arrays of arrays. In a jagged array the contents of the array are arrays which may hold instances of a type or references to other arrays.
在Java和C#中,數組不一定要一緻,因為交錯數組能被生成作為一維數組的數組。
在交錯數組中,數組的内容是數組,它們裡面容納一個類型的很多執行個體或引用其他數組。
例子:
int [][]myArray = new int[2][];
myArray[0] = new int[3];
myArray[1] = new int[9];