其他

1.publicclassExceptionTest{2.classTestExceptionextendsException{}3.publicvoidrunTest()throwsTestException{}4.publicvoidtest()/*PointX*/{5.runTest();6.}7.}AtPointXonline4,whichcodeisnecessarytomakethecodecompile?()A.Nocodeisnecessary.B.throwsExceptionC.cat

题目

1.publicclassExceptionTest{2.classTestExceptionextendsException{}3.publicvoidrunTest()throwsTestException{}4.publicvoidtest()/*PointX*/{5.runTest();6.}7.}AtPointXonline4,whichcodeisnecessarytomakethecodecompile?()

A.Nocodeisnecessary.

B.throwsException

C.catch(Exceptione)

D.throwsRuntimeException

E.catch(TestExceptione)

参考答案和解析
参考答案:B
如果没有搜索结果,请直接 联系老师 获取答案。
相似问题和答案

第1题:

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

第2题:

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.


参考答案:A

第3题:

publicclassExceptionTest{classTestExceptionextendsException{}publicvoidrunTest()throwsTestException{}publicvoidtest()/*PointX*/{runTest();}}AtpointXonline4,whichcodecanbeaddedtomakethecodecompile?()

A.ThrowsException.

B.Catch(Exceptione).

C.ThrowsRuntimeException.

D.Catch(TestExceptione).

E.Nocodeisnecessary.


参考答案:B