我简单用代码试了一下,实验代码在这里,楼主看一下- class Demo2
- {
- public static void main(String[] args) /*throws Exception*/{
- try{
- s1();
- s2();
- s3();
- }
- //finally{}
- catch (Exception e) {
- // TODO: handle exception
- System.out.println(e.getMessage());
- new Exception("s2异常");
- }
- s4();
- }
- public static void s1() {
- System.out.println("s1");
- }
- public static void s2() {
- int [] arr=new int[]{1,2,3};
- System.out.println(arr[5]);
- System.out.println("s2");
- }
- public static void s3() {
- System.out.println("s3");
- }
- public static void s4() {
- System.out.println("s4");
- }
- }
复制代码 |