异常处理
public class CatchWho2 {public static void main(String[] args) {
try{
try {
throw new ArrayIndexOutOfBoundsException();
}
catch(ArithmeticException e) {
System.out.println(
"ArrayIndexOutOfBoundsException" +
"/内层 try...catch");
}
throw new ArithmeticException();
}
catch(ArithmeticException e) {
System.out.println("发生ArithmeticException");
}
catch(ArrayIndexOutOfBoundsException e) {
System.out.println(
"ArrayIndexOutOfBoundsException" +
"/外层 try...catch");
}
}
}
结果显示为:
ArrayIndexOutOfBoundsException/外层 try...catch
为什么没有显示“发生ArithmeticException”