A.Anexceptionisthrown.
B.Thecodedoesnocompile.
C.“HelloWorld.”Isprintedtotheterminal.
D.Theprogramexitswithoutprintinganything.
第1题:
A.Anexceptionisthrown.
B.Thecodewillnotcompile.
C.Theprogramprints“null”
D.Theprogramprints“blue”
E.Theprogramprints“green”
第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.
第3题:
A.Thecodecompilesand“s=”isprinted.
B.Thecodecompilesand“s=null”isprinted.
C.Thecodedoesnotcompilebecausestringsisnotinitialized.
D.Thecodedoesnotcompilebecausestringscannotbereferenced.
E.Thecodecompiles,butaNullPointerExceptionisthrownwhentoStringiscalled.
第4题:
A.Thecodecompilesand“s=”isprinted.
B.Thecodecompilesand“s=null”isprinted.
C.Thecodedoesnotcompilebecausestringsisnotinitialized.
D.Thecodedoesnotcompilebecausestringscannotbereferenced.
E.Thecodecompiles,butaNullPointerExceptionisthrownwhentoStringiscalled.
第5题:
A.Theprogramrunsandprintsnothing.
B.Theprogramrunsandprints“Finally”
C.Thecodecompiles,butanexceptionisthrownatruntime.
D.Thecodewillnotcompilebecausethecatchblockismissing.