runtimeException也是能够捕获的
如题,运行结果:
bbb
abcdef
@Test public void testRuntimeException() { int a = 0;try {
aaa333();
} catch (Exception ex) {
System.out.println("bbb");
}System.out.print("abcdef");
}private void aaa333() {
int a = 0;try {
int b = 32 / a;
} catch (Exception ex) {
throw new RuntimeException("error;");
}
}

浙公网安备 33010602011771号