异常的Root Class是Throwable,Throwable派生了Error和Exception。

Java 8 API Doc中对checked exception和unchecked exception 的说明:

1. checked exception:(在Exception类中的说明)

The class Exception and any subclasses that are not also subclasses of RuntimeException are checked exceptions. 

 

2. unchecked exception:

(在Error类中说明)

 Error and its subclasses are regarded as unchecked exceptions for the purposes of compile-time checking of exceptions

(在RuntimeException类中的说明)

RuntimeException and its subclasses are unchecked exceptions. 

 

3. checked exception:编译器要求对其进行显示的捕获或抛出,例如,IOException,SQLException;

unchecked exception:一般发生在运行期,编译器不要求对其进行显示的捕获或抛出,例如NullPointerException,ClassCastException;

 

RuntimeException and its subclasses are unchecked exceptions

相关文章:

  • 2022-01-18
  • 2021-11-01
  • 2021-06-05
  • 2021-09-08
  • 2021-11-09
  • 2021-12-03
猜你喜欢
  • 2021-11-01
  • 2021-09-13
  • 2022-12-23
  • 2021-04-11
  • 2022-12-23
  • 2021-07-20
相关资源
相似解决方案