jdk_异常处理

类结构:

jdk_异常处理_第1张图片
image.png

The Throwable class is the superclass of all errors and exceptions in the Java language. Only objects that are instances of this class (or one of its subclasses) are thrown by the Java Virtual Machine or can be thrown by the Java throw statement.

Java provides three kinds of throwables:

checked exceptions,:except runtime exceptions: Errors

runtime exceptions: is the superclass of those exceptions that can be thrown during the normal operation of the Java Virtual Machine.

Errors.: a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions.

Errors and runtime exceptions and compile-time checking of exceptions

grammar:

Try {

}catch(...){

}finally(

)

Exception chain 异常链:

以一个异常对象为参数构造新的异常对象。新的异对象将包含先前异常的信息

Customer exception 自定义异常:拓展exception

Eg: IoException

jdk_异常处理_第2张图片
image.png

你可能感兴趣的:(jdk_异常处理)