第一种,不catch异常
try {
try {
throw new Exception();
} finally {
System.out.println("A");
}
} catch (Exception e) {
System.out.println("B");
} finally {
System.out.println("C");
}
结果输出:
A
B
C
第二种,catch异常
try {
try {
throw new Exception();
} catch (Exception e) {
System.out.println("A");
}
} catch (Exception e) {
System.out.println("B");
} finally {
System.out.println("C");
}
结果输出:
A
C