-->
当前位置:首页 > 题库 > 正文内容

单选题:阅读以下Java程序,其编译运行结果是?

Luz4年前 (2021-12-25)题库892
阅读以下Java程序,其编译运行结果是?

public class Test {
public int div(int a, int b) {
try {
return a / b;
}catch(Exception e){
System.out.println("Exception");
}catch(NullPointerException e){
System.out.println("ArithmeticException");
}catch (ArithmeticException e) {
System.out.println("ArithmeticException");
} finally {
System.out.println("finally");
}
return 0;
}
public static void main(String[] args) {
Test demo = new Test();
System.out.println("商是:" + demo.div(9, 0));
}
}




A.Exception<br>
finally<br>
商是:0
B.ArithmeticException<br>
finally<br>
商是:0
C.finally<br>
商是:0
D.编译报错


答案:D

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。