你看看这两种情况,是否复合你所说的- class Test
- {
-
- public static void main(String args[]){
-
- try{
- int[] i={1,2,3};
- System.out.println(i[5]);
- }
- catch(Exception e){
- System.out.println("in try-catch");
- }
-
- System.out.println("after try-catch");
-
- error_test();
- }
-
-
- static void error_test(){
- try {
- int[] i={1,2,3};
- System.out.println(i[5]);
- } catch (Exception e) {
- // TODO: handle exception
- throw new RuntimeException("出错了");
- }
-
- System.out.println("after try-catch-throw");
- }
- }
复制代码 结果:
|
|