📄 exceptiondemo3.java
字号:
import java.io.*;
public class ExceptionDemo3{
public static void main(String[] args){
try{
int len = args.length;
System.out.println("\n Len = " + len);
int b = 42/len;
int[] c = {1};
c[42]=99;
}
catch(ArithmeticException e1){
System.out.println("发生了被0除异常!" + e1);
}
catch(IndexOutOfBoundsException e2){
System.out.println("数组下标越界!" + e2);
}
catch(Exception e3){
System.out.println("发生了异常!" + e3);
}
finally{
System.out.println("finally语句被执行!");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -