阅读下列程序片段 Publicvoidtest(){ Try{ sayHello(); system.out.println(“hello"); }catch(ArrayIndexOutOfBoundExceptione){

admin2010-04-08  43

问题 阅读下列程序片段    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://kaotiyun.com/show/699p777K
0

最新回复(0)