定义时区分uncheckedchecked异常Excetion

    xiaoxiao2023-09-30  147

    1.我们可以从英语的角度理解 unchecked/checked

    uchecked 这个词加了 ed 英文解释也就是 应该要被check但是没有check 也就是说这种错误就是你自身不谨慎仔细导致的 所以说像 NullPointException(NPE)ArrayIndexOutOfBoundsException (数组越界)ClassNotFoundExceptionUnknowTypeExceptionIllegalArgumentExcption checked 这个词也加了 ed ,当你在编译时就会被校验,英语解释已经被校验 所以这种异常会通过编译

    从2张图中可以看出来 父类都是Exception uchecked 是继承RunTimeException 但所有 RuntimeException 的子类都有个特点,就是代码不需要处理它们的异常也能通过编译

    借用图 https://www.cnblogs.com/liuhongfeng/p/4173232.html https://blog.csdn.net/qq_14982047/article/details/50989761

    最新回复(0)