Exception分为unchecked Exception和checked Exception,其中unchecked Exception指runtimeException与其子类,这类异常不需要try-catch捕获或throws抛出,如:
1.java.lang.NullPointerException;
2.java.lang.ArithmaticException;
3.java.lang.ArrayIndexoutofBoundsException
而checked Exception是必须处理的异常,编译器会强制你去处理可能出现的checked Exception,如:
IOException、NoSuchFieldException、InterruptedException等。