📄 throwsdemo.java
字号:
package chapter14;
public class ThrowsDemo {
public static void compute() throws ArithmeticException,
ArrayIndexOutOfBoundsException {
System.out.println("the method compute");
int[] x = new int[3];
for (int i = 0; i <= 3; i++) {
System.out.println(x[i]);
}
}
public static void main(String[] args) {
try {
compute();
} catch (ArithmeticException e) {
System.out.println("数学运算错误");
} catch (ArrayIndexOutOfBoundsException e) {
System.out.println("数组越界错误");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -