网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
publicclassfoo{publicstaticvoidmain(String[]args){Strings;system.out.printIn(s=”+s);}}Whatistheresult?()

A.Thecodecompilesand“s=”isprinted.

B.Thecodecompilesand“s=null”isprinted.

C.Thecodedoesnotcompilebecausestringsisnotinitialized.

D.Thecodedoesnotcompilebecausestringscannotbereferenced.

E.Thecodecompiles,butaNullPointerExceptionisthrownwhentoStringiscalled.


参考答案

更多 “ publicclassfoo{publicstaticvoidmain(String[]args){Strings;system.out.printIn(s=”+s);}}Whatistheresult?() A.Thecodecompilesand“s=”isprinted.B.Thecodecompilesand“s=null”isprinted.C.Thecodedoesnotcompilebecausestringsisnotinitialized.D.Thecodedoesnotcompilebecausestringscannotbereferenced.E.Thecodecompiles,butaNullPointerExceptionisthrownwhentoStringiscalled. ” 相关考题
考题 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.

考题 publicclassFoo{publicvoidmain(String[]args){system.out.printIn(HelloWorld.”);}}Whatistheresult?() A.Anexceptionisthrown.B.Thecodedoesnocompile.C.“HelloWorld.”Isprintedtotheterminal.D.Theprogramexitswithoutprintinganything.

考题 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(String[]args){Strings1=newString(true”);Booleanb1=newBoolean(true);if(s2.equals(b1)){System.out.printIn(Equal”);}}}Whatistheresult?() A.Theprogramrunsandprintsnothing.B.Theprogramrunsandprints“Equal”C.Anerroratline5causescompilationtofail.D.Theprogramrunsbutabortswithanexception.

考题 publicclassfoo{staticStrings;publicstaticvoidmain(String[]args){system.out.printIn(s=”+s);}}Whatistheresult?() A.Thecodecompilesand“s=”isprinted.B.Thecodecompilesand“s=null”isprinted.C.Thecodedoesnotcompilebecausestringsisnotinitialized.D.Thecodedoesnotcompilebecausestringscannotbereferenced.E.Thecodecompiles,butaNullPointerExceptionisthrownwhentoStringiscalled.

考题 publicclassfoo{publicstaticvoidmain(string[]args)try{return;}finally{system.out.printIn(Finally”);}}Whatistheresult?() A.Theprogramrunsandprintsnothing.B.Theprogramrunsandprints“Finally”C.Thecodecompiles,butanexceptionisthrownatruntime.D.Thecodewillnotcompilebecausethecatchblockismissing.

考题 publicclassFoo{publicstaticvoidmain(String[]args){try{return;}finally{System.out.println(Finally”);}}}Whatistheresult?() A.FinallyB.Compilationfails.C.Thecoderunswithnooutput.D.Anexceptionisthrownatruntime.

考题 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.

考题 publicclassfoo{publicstaticvoidmain(Stringargs){Strings;system.out.printIn(s=”+s);}}Whatistheresult?() A.Thecodecompilesand“s=”isprinted.B.Thecodecompilesand“s=null”isprinted.C.Thecodedoesnotcompilebecausestringsisnotinitialized.D.Thecodedoesnotcompilebecausestringscannotbereferenced.E.Thecodecompiles,butaNullPointerExceptionisthrownwhentoStringiscalled.