下列语句中错误的是()
A: String s[]={"how","are"};
B: byte b=255;
C: String s="one"+"two";
D: int i=2+2000;
A: String s[]={"how","are"};
B: byte b=255;
C: String s="one"+"two";
D: int i=2+2000;
举一反三
- 下列语句能给数组赋值而不使用for循环的是 A: myArray{[1]="One";[2]="Two";[3]="Three";} B: String s[5]=new String[]{"Zero", "One", "Two", "There", "Four"}; C: String s[]=new String[]{"Zero", "One", "Two", "There", "Four"}; D: String s[]=new String[]=|"Zero", "One", "Two", "There", "Four"};
- 下面的表达式( )是错误的。 A: String s=null; int i=(s!=null)&&(s.length()>0)?s.length():0; B: String s="你好";int i=3; if(i==s){ s+=i}; C: String s="你好";int i=3; s=i+s; D: String s="你好";int i=3; s+=i;
- 下面的代码片段中正确的是那一项? A: String s=″你好″;int i=3;i+=s; B: String s=″你好″;int i=3;if(i==s){s+=i}; C: String s=″你好″;int i=3;s=i+s; D: String s=″你好″;int i=3;s=i+;
- 正确创建一个含有 5 个元素的字符串数组的选项是: A: String s[ 5] = new String[5]; for(int i=0;i<5;s[i++]=“”); B: String s[ ]={“”, “”, “”, “”, “”}; C: String s[5]; D: String [5]s;
- 下面的哪些程序片断可能导致错误() A: String s = "Gone with the wind"; String t = " good "; String k = s + t; B: String s = "Gone with the wind"; String t; t = s[3] + "one"; C: String s = "Gone with the wind"; String standard = s.toUpperCase(); D: String s = "home directory"; String t = s - "directory"