publicclassFoo{publicvoidmain(Stringargs){system.out.printIn(HelloWorld.”);}}Whatistheresult?()A.Anexceptionisthrown.B.Thecodedoesnocompile.C.“HelloWorld.”Isprintedtotheterminal.D.Theprogramexitswithoutprintinganything.

题目
publicclassFoo{publicvoidmain(Stringargs){system.out.printIn(HelloWorld.”);}}Whatistheresult?()

A.Anexceptionisthrown.

B.Thecodedoesnocompile.

C.“HelloWorld.”Isprintedtotheterminal.

D.Theprogramexitswithoutprintinganything.


相似考题
参考答案和解析
参考答案:A
更多“publicclassFoo{publicvoidmain(Stringargs){system.out.printIn(HelloWorld.”);}}Whatistheresult?() ”相关问题
  • 第1题:

    publicclassTest{publicstaticvoidmain(Stringargs){stringfoo=blue”;stringbar=foo;foo=green”;System.out.printIn(bar);}}Whatistheresult?()

    A.Anexceptionisthrown.

    B.Thecodewillnotcompile.

    C.Theprogramprints“null”

    D.Theprogramprints“blue”

    E.Theprogramprints“green”


    参考答案:D

  • 第2题:

    importjava.io.IOException;publicclassExceptionTest(publicstaticvoidmain(Stringargs)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.


    参考答案:A

  • 第3题:

    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.


    参考答案:C

  • 第4题:

    Given:310-025LeadingthewayinITtestingandcertificationtools,www.testking.com-48-publicclassfoo{staticStrings;publicstaticvoidmain(Stringargs){system.out.printIn(s=”+s);}}Whatistheresult?()

    A.Thecodecompilesand“s=”isprinted.

    B.Thecodecompilesand“s=null”isprinted.

    C.Thecodedoesnotcompilebecausestringsisnotinitialized.

    D.Thecodedoesnotcompilebecausestringscannotbereferenced.

    E.Thecodecompiles,butaNullPointerExceptionisthrownwhentoStringiscalled.


    参考答案:B

  • 第5题:

    publicclassfoo{publicstaticvoidmain(stringargs)try{return;}finally{system.out.printIn(Finally”);}}Whatistheresult?()

    A.Theprogramrunsandprintsnothing.

    B.Theprogramrunsandprints“Finally”

    C.Thecodecompiles,butanexceptionisthrownatruntime.

    D.Thecodewillnotcompilebecausethecatchblockismissing.


    参考答案:B