zoukankan      html  css  js  c++  java
  • 异常处理—checked exception 和 unchecked exception

    异常的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

  • 相关阅读:
    css--盒子模型
    目标爬取社会信用码
    KFC-位置分页爬虫
    百度翻译-爬虫
    网页采集器-UA伪装
    python模块2
    python模块
    go入门
    python垃圾回收机制
    Python高级用法
  • 原文地址:https://www.cnblogs.com/jayinnn/p/10986633.html
Copyright © 2011-2022 走看看