一、已检异常
已检异常在明确的特定情况下需要进行抛出,经常是应用能部分或完全恢复的情况。其通常要通过try catch 进行处理的异常。
二、未检异常
只要对象是Error类,就是未检异常,同时Exception还有一个子类RuntimeException所有的子类也是未检异常,可以不适用try catch进行处理。这类异常如果有异常要进行处理那么其由JVM自己进行处理。
RuntimeException包含的子类:
①NullpointerException
②NumberFormatException :继承自IllegalArgumentException 比如:字符串转换为数字时出现:int i=Integer.parseInt("ab3");
③ArrayIndexOutofBoundsException
④StringIndexOutofBoundsException :字符串越界
⑤ClassCastException
⑥UnsupportedOperationException:该操作不被支持
⑦AnthmeticException
⑧IllegalArgumentException