catchwho2.java

来自「有关java学习技巧的课件」· Java 代码 · 共 24 行

JAVA
24
字号
public class CatchWho2 { 
    public static void main(String[] args) { 
        try {
            try { 
                throw new ArrayIndexOutOfBoundsException(); 
            } 
            catch(ArithmeticException e) { 
                System.out.println(
                    "ArrayIndexOutOfBoundsException" + 
                    "/内层try-catch"); 
            }
 
            throw new ArithmeticException(); 
        } 
        catch(ArithmeticException e) { 
            System.out.println("发生ArithmeticException"); 
        } 
        catch(ArrayIndexOutOfBoundsException e) { 
            System.out.println(
                "ArrayIndexOutOfBoundsException" + 
                "/外层try-catch"); 
        } 
    } 
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?