📄 multicatch.java
字号:
public class multiCatch {
public static void main(String[] args) {
int i = 0;
int j = 0;
try {
i = Integer.parseInt(args[0]);
j = Integer.parseInt(args[1]);
System.out.println(i + "/" + j + " = " + i / j);
}
catch (NumberFormatException e) {
System.out.println("NumberFormatException ");
System.err.println("Usage: java multiCatch number1 number2");
}
catch (ArrayIndexOutOfBoundsException e) {
System.out.println("ArrayIndexOutOfBoundsException");
System.err.println("Usage: java multiCatch number1 number2");
}
catch (ArithmeticException e) {
System.out.println("ArithmeticException ");
System.err.println(e.getMessage());
}
catch (Exception e) {
System.err.println(e);
System.err.println(e.getMessage());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -