Consider this pair of Throwable
:
IllegalAccessException
extends Exception
Thrown when an application tries to reflectively cr
There are several pairs of Exception/Error in java.lang
, and all of the following deal with reflective vs. direct usage:
IllegalAccessException / IllegalAccessError
InstantiationException / InstantiationError
ClassNotFoundException / NoClassDefFoundError
NoSuchFieldException / NoSuchFieldError
NoSuchMethodException / NoSuchMethodError
Other examples are:
java.awt.AWTException / java.awt.AWTError
java.io.IOException / java.io.IOError
Until now, I didn't know these two errors existed, and they are not referenced from other classes in the Javadoc (1.6). So I don't know if and when they are thrown.