[单项选择题] 阅读下列程序片段Publicvoidtest()TrysayHello();system.out.println(“hello");catch(Array

[单项选择题] 阅读下列程序片段Publicvoidtest()TrysayHello();system.out.println(“hello");catch(Array,第1张

[单项选择题] 阅读下列程序片段 Publicvoidtest() Try sayHello(); system.out.println(“hello"); catch(Array

[单项选择题] 阅读下列程序片段

Publicvoidtest()

Try

sayHello();

system.out.println(“hello");

catch(ArrayIndexOutOfBoundExceptione)

System.out.println(“ArraylndexOutOfBoundException”);

catch(Exceptione)

System.out.println(“Exception”);

finally

System.out.println(“finally”);

如果sayHello()方法正常运行,则test()方法的运行结果将是( )。

A.Hello

B.ArraylndexOutOfBondsException

C.Exception

Finally

D.Hello

Finally

正确答案:

D

参考解析:

sayHello()方法正常运行则程序不抛出异常,并走finally,所以为D。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5591493.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-14
下一篇2022-12-14

发表评论

登录后才能评论

评论列表(0条)

    保存