A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

© 壊亊唑侭 中级黑马   /  2015-8-26 00:51  /  277 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文


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) 编译报错

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马