5
下面哪个数组定义是错误的。
并对错误的答案加上单行注释,写出错误的原因。
A,float[]=new float[3];
B, float f2[]=new float[];
C, float[] f1=new float[3];。
D, boolean[] b={"true","false","true"};。
E, double f4[]={1,3,5};
F, int f5[]=new int[3]{2,3,4};
G, float f4[]={1.2,3.0,5.4}; 收起
并对错误的答案加上单行注释,写出错误的原因。
A,float[]=new float[3];
B, float f2[]=new float[];
C, float[] f1=new float[3];。
D, boolean[] b={"true","false","true"};。
E, double f4[]={1,3,5};
F, int f5[]=new int[3]{2,3,4};
G, float f4[]={1.2,3.0,5.4}; 收起
我有更好的答案
推荐于2016-05-27 13:18:32
最佳答案
A 未定义变量名
B 未初始化数组长度
C 如果后面的全角"。"不算的话就没错
D 如果后面的全角"。"不算的话,类型不对,true/false加引号为String型,不是boolean型
E 对
F 数组定义时不能同时初始化 长度和值
G 类型不对,float型要在后加f,如1f,2.3f