该程序的输出是什么?( )
执行命令行 :
$ java exception_handling one
class exception_handling {
public static void main(String args[]) {
try {
int a = args.length;
int b = 10 / a;
System.out.print(a);
try {
if (a == 1)
a = a / a - a;
if (a == 2) {
int c = {1};
c[8] = 9;
}
} catch (ArrayIndexOutOfBoundException e) {
System.out.println("TypeA");
} catch (ArithmeticException e) {
System.out.println("TypeB");
}
}
}
}TypeA
TypeB
编译错误
运行时错误
1
不同catch代码块的Exception变量不能同名。