执行代码Strings=newString("Hello")后,正确的结论是()
第1题:
此题为判断题(对,错)。
第2题:
A.s.equals(t);
B.t.equals(c);
C.s==t;
D.t.equals(newString("hello"));
E.t==c;
第3题:
定义String s=null,会出现异常的选项是( )。 Ⅰ: if((s!=mll)&(s.length()>0)) Ⅱ: if((s!=mull)&&(s.length()>0)) Ⅲ: if((s==null)|(s.length()==0)) Ⅳ: if((s==aull)Ⅱ(s.length()==0))
A.Ⅱ、Ⅲ
B.Ⅱ、Ⅲ、Ⅳ
C.Ⅰ、Ⅲ
D.Ⅲ、Ⅳ
第4题:
已知有如下语句: s="hello, world" r=Mid(s,7,5) 运行上面的语句后,变量r的值为 ( )
A.hello
B.wotld
C.llo,w
D.orld
第5题:
A.Theprogramrunsandprints“Hello”
B.Anerrorcausescompilationtofail.
C.Theprogramrunsandprints“Helloworld!”
D.Theprogramrunsbutabortswithanexception.
第6题:
执行下列代码后,哪个结论是正确的String[]s=newString[10];()
A、[10]为"";
B、[9]为null;
C、[0]为未定义
D、lengtH为10
第7题:
A.Theprogramrunsandprints“Hello”
B.Anerrorcausescompilationtofail.
C.Theprogramrunsandprints“Helloworld!”
D.Theprogramrunsbutabortswithanexception.
第8题:
执行下列代码后,哪个结论是正确的String[]s=newString[10];()
A、s[10]为““;
B、s[9]为null;
C、s[0]为未定义
D、s.length为10
第9题:
下列代码的执行结果是()。publicclasstest5{publicstaticvoidmain(Stringargs[]){Strings1=newString("hello");Strings2=newString("hello");System.out.prim(s1==s2);System.out.print(",");System.out.println(s1.equals(s2));}
A.true,false
B.true,true
C.false,true
D.false,false
第10题:
已知有定义:Strings="story",下面()表达式是合法的。
A.s+="books";
B.charC=s[1];
C.intlen=s.length;
D.Strings=s.toLowerCase();