exception 检测异常和免检异常

object的子类throwable是所有异常的父类,包括Erro(系统异常),Exception。Erro为免检异常,编译时ide不检测。Exception的子类有RuntimeException(免检异常),SqlException,AwtException,IOException,除了Erro和RuntimeException其他全为检测异常。RuntimeException中有IndexOutOfBoundsException(数组越界异常),ArithmeticException(算数异常),NullPointerException(指向对象为空异常),ClassCastException(类型强制转换异常),IllegalArgumentException(传递非法参数异常),NumberFormatException(数值转换异常),ArrayStoreException(向数组中存放与声明类型不兼容对象异常)

猜你喜欢

转载自blog.csdn.net/qq_41734885/article/details/80160657