Which two statements are true for a two-dimensional array of primitive data type?
A. It cannot contain elements of different types.
B. The length of each dimension must be the same.
C. At the declaration time, the number of elements of the array in each dimension must be specified.
D. All methods of the class object may be invoked on the two-dimensional array.
题解
选项 A,基本数据型态的二维数组不能包含其他不同型态的元素,这是正确的。
选项 B,Java 允许多维数组每个维度拥有不同的长度。
选项 C,定义数组型态的时候,可以先不用把每个维度的元素数量给决定好,实体化数组对象的时候再决定即可。
选项 D,所有在 Object 类别里的方法都可以在数组中调用,因为数组也是对象,同样继承自 Object 类别。
