数组的声明与构造
which two create an instance of an array?
A. int [] ia = new int [15];
B. float fa = new float [20];
C. char [] ca = "Some String";
D. Object oa = new float[10];
E. int ai [][] = {{4, 5, 6},{1, 2, 3}} ;
Answer:AD
请问为什么B错误而D正确呢?
[解决办法]
B错误因为B声明的是一个非数组的基本类型,而给其赋值是一个数组对象
D正确因为任何数组都是继承自Object.