网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
Stringtest=a1b2c3”;12.String[]tokens=test.split(”\\d”);13.for(Strings:tokens)System.out.print(s+);Whatistheresult?()
A.abc
B.123
C.a1b2c3
D.a1b2c3
E.Compilationfails.
F.Thecoderunswithnooutput.
G.Anexceptionisthrownatruntime.
参考答案
更多 “ Stringtest=a1b2c3”;12.String[]tokens=test.split(”\\d”);13.for(Strings:tokens)System.out.print(s+);Whatistheresult?() A.abcB.123C.a1b2c3D.a1b2c3E.Compilationfails.F.Thecoderunswithnooutput.G.Anexceptionisthrownatruntime. ” 相关考题
考题
importjava.util.*;publicclassLetterASort{publicstaticvoidmain(String[]args){ArrayListstrings=newArrayList();strings.add(?aAaA”);strings.add(”AaA”);strings.add(?aAa”);strings.add(”AAaa”);Collections.sort(strings);for(Strings:strings){System.out.print(s+);}}}Whatistheresult?()A.Compilationfails.B.aAaAaAaAAaaAaAC.AAaaAaAaAaaAaAD.AaAAAaaaAaAaAaE.aAaAaAaAaAAAaaF.Anexceptionisthrownatruntime.
考题
Stringtest=Thisisatest”;12.String[]tokens=test.split(”\s”);13.System.out.println(tokens.length);Whatistheresult?()
A.0B.1C.4D.Compilationfails.E.Anexceptionisthrownatruntime.
考题
publicclassX{publicstaticvoidmain(String[]args){strings=newstring(Hello”);modify(s);System.out.printIn(s);}publicstaticvoidmodify(Strings){s+=world!”;}}Whatistheresult?()
A.Theprogramrunsandprints“Hello”B.Anerrorcausescompilationtofail.C.Theprogramrunsandprints“Helloworld!”D.Theprogramrunsbutabortswithanexception.
考题
publicclassX{publicstaticvoidmain(Stringargs){strings=newstring(Hello”);modify(s);System.out.printIn(s);}publicstaticvoidmodify(Strings){s+=world!”;}}Whatistheresult?()
A.Theprogramrunsandprints“Hello”B.Anerrorcausescompilationtofail.C.Theprogramrunsandprints“Helloworld!”D.Theprogramrunsbutabortswithanexception.
考题
Given:11.Stringtest=Thisisatest;12.String[]tokens=test.split(\s);13.System.out.println(tokens.length);Whatistheresult?()
A.Anexceptionisthrownatruntime.B.1C.4D.Compilationfails.E.0
考题
Given:11.Stringtest=Thisisatest;12.String[]tokens=test.split(\s);13.System.out.println(tokens.length);Whatistheresult?()
A.0B.1C.4D.Compilationfails.
考题
Given:11.Stringtest=a1b2c3;12.String[]tokens=test.split(\\d);13.for(Strings:tokens)System.out.print(s+);Whatistheresult?()
A.abcB.123C.a1b2c3D.a1b2c3
考题
1、写出以下程序的运行结果? public class Test{ public static void main(String argv[]){ String s = new String("hello"); myMethod(s); System.out.print("s=" + s); } public static void myMethod(String s){ s = s + "!"; } }A.s=hello!B.s=helloC.hello!D.hello
考题
写出以下程序的运行结果? public class Test{ public static void main(String argv[]){ String s = new String("hello"); myMethod(s); System.out.print("s=" + s); } public static void myMethod(String s){ s = s + "!"; } }A.s=hello!B.s=helloC.hello!D.hello
热门标签
最新试卷