Java Reference
In-Depth Information
Table19-1
SubclassesofException
IOEXCEPTION
RUNTIMEEXCEPTION
ChangedCharSetException ArithmeticException
CharConversionException ArrayStoreException
EOFException CannotRedoException
FileNotFoundException CannotUndoException
InterruptedIOException ClassCastException
MalformedURLException CMMException
ObjectStreamException CurrentModificationException
ProtocolException EmptyStackException
RemoteException IllegalArgumentException
SocketException IllegalStateException
SyncFailedException ImaginingOpException
UnknownHostException IndexOutOfBoundsException
UnknownServiceException MissingResourceException
UnsupportedEncodingExceptionNegativeArraySizeException
UTFDataFormatException
NoSuchElementException
ZipException
NullPointerException
ProfileDataException
ProviderException
RasterFormatException
SecurityException
SystemException
UnsupportedOperationException
Inaddition,applicationcodecanextendtheJavaExceptionclassinor-
dertoprovideitsownexceptionconditions.Thispossibilityisshownby
theclassinagrayrectanglein Figure19-1 .Providingyourownexception
handlers is discussed later in this chapter.
Advertising exceptions
Java specifications state that exceptions that derive from the class Error or
from the class RuntimeException are classified as unchecked exceptions.
All other exceptions are checked. Unchecked exceptions are either beyond
program control, as those related to the Error class, or relate to conditions
that are beyond program action, as is the case with an array index out of
bounds. Code must deal with checked exceptions.
A Java method informs the user that it could generate an exception by
declaring it in the method header. For example, a method named
WriteToFile() that could produce an exception named NameError would
be declared as follows:
public void WriteTo File()
throws NameErrorException
 
Search WWH ::




Custom Search