黑马程序员技术交流社区

标题: 以下程序运行结果是(D) [打印本页]

作者: 壊亊唑侭    时间: 2015-8-26 00:51
标题: 以下程序运行结果是(D)

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 finally 商是:0
B) ArithmeticException finally 商是:0
C) finally商是:0
D) 编译报错




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2