java 异常机制

异常

异常分类

异常的体系结构

Error 错误

Exception 异常

package exception;

public class Demo01 {
    public static void main(String[] args) {
//        new Demo01().a(); //Exception in thread "main" java.lang.StackOverflowError

        System.out.println(11/0);//Exception in thread "main" java.lang.ArithmeticException: / by zero
    }

    public void a() {
        b();
    }

    public void b() {
        a();
    }
}

posted @ 2021-08-03 21:01  阿向向  阅读(26)  评论(0编辑  收藏  举报