Exception
Exception
main.c
Reasons Not To Use Ad Hoc Approach
Exceptions in Java are not new and different entities (like in Ada or
SML). Exceptions are Java classes which are subclasses of
java.lang.Throwable.
An exception is not a separate kind of entity in Java, it is a class. But
exceptions do have a special role in the language. They are not the
programmer’s data, but they serve as signals or indicators.
Since different instances of an exception class are usually
indistinguishable and not very important, we have a tendency to blur
the distinction between an exception and an instance of the exception.
We speak of the FileNotFoundException exception, and not of an
instance of the FileNotFoundException exception.
Class Hierarchy
Object
Throwable
Error Exception
RuntimeException
checked
Checked
If a methods throws a checked exception (and does not catch it), then
it must declare the fact in a throws clause.
static void method ( String arg ) throws AnException
try {