01 整体理解异常和错误

整体理解异常和错误

image

什么是异常

image

异常结构体系分类

image

image

Error

image

Exception

image

代码

package com.zhan.base06Exception.demo01;


public class Test01 {
// 异常
    public static void main(String[] args) {
        System.out.println(10/0); // 异常 Exception in thread "main" java.lang.ArithmeticException: / by zero
        a(); // 异常 Exception in thread "main" java.lang.StackOverflowError
        
    }

    static void a(){
       b();
    }

    static void b(){
        a();
    }
}
posted @ 2023-02-14 17:03  被占用的小海海  阅读(13)  评论(0)    收藏  举报