网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
publicclassFoo{publicvoidmain(String[]args){system.out.printIn(HelloWorld.”);}}Whatistheresult?()
A.Anexceptionisthrown.
B.Thecodedoesnocompile.
C.“HelloWorld.”Isprintedtotheterminal.
D.Theprogramexitswithoutprintinganything.
参考答案
更多 “ publicclassFoo{publicvoidmain(String[]args){system.out.printIn(HelloWorld.”);}}Whatistheresult?() A.Anexceptionisthrown.B.Thecodedoesnocompile.C.“HelloWorld.”Isprintedtotheterminal.D.Theprogramexitswithoutprintinganything. ” 相关考题
考题
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.
考题
importjava.io.IOException;publicclassExceptionTest(publicstaticvoidmain(String[]args)try(methodA();)catch(IOExceptione)(system.out.printIn(CaughtIOException”);)catch(Exceptione)(system.out.printIn(CaughtException”);))publicvoidmethodA(){thrownewIOException();}Whatistheresult?()A.Thecodewillnotcompile.B.Theoutputiscaughtexception.C.TheoutputiscaughtIOException.D.Theprogramexecutesnormallywithoutprintingamessage.
考题
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){Strings;system.out.printIn(s=”+s);}}Whatistheresult?()
A.Thecodecompilesand“s=”isprinted.B.Thecodecompilesand“s=null”isprinted.C.Thecodedoesnotcompilebecausestringsisnotinitialized.D.Thecodedoesnotcompilebecausestringscannotbereferenced.E.Thecodecompiles,butaNullPointerExceptionisthrownwhentoStringiscalled.
考题
publicclassFoo{publicvoidmain(String[]args){System.out.println(Hello”+args[0]);}}Whatistheresultifthiscodeisexecutedwiththecommandline?()
A.HelloB.HelloFooC.HelloworldD.Compilationfails.E.Thecodedoesnotrun.
考题
publicclassFoo{publicstaticvoidmain(String[]args){try{return;}finally{System.out.println(Finally”);}}}Whatistheresult?()
A.FinallyB.Compilationfails.C.Thecoderunswithnooutput.D.Anexceptionisthrownatruntime.
考题
publicclassFoo{publicvoidmain(Stringargs){system.out.printIn(HelloWorld.”);}}Whatistheresult?()
A.Anexceptionisthrown.B.Thecodedoesnocompile.C.“HelloWorld.”Isprintedtotheterminal.D.Theprogramexitswithoutprintinganything.
考题
作为Java应用程序入口的main方法,其声明格式可以是( )。A、publicstaticvoidmain(String[]args)B、publicstaticintmain(String[]args)C、publicvoidmain(String[]args)D、publicintmain(String[]args)
考题
以下哪个main方法是正确的?A.public static void main(string[] args)B.public static void Main(String[] args)C.public static void main(String[] args)D.public static main(String[] args)E.public void main(String[] args)
热门标签
最新试卷