Java小笔记
- catch多种异常
try {
int a = 1 / 0;// 除以0
} catch (ArithmeticException | ArrayIndexOutOfBoundsException e) {
// 多个异常见用 | 隔开
// 多个异常必须是平级关系
System.out.println("发生了ArithmeticException 或者 ArrayIndexOutOfBoundsException 异常");
}

浙公网安备 33010602011771号