As you have undoubtedly noticed in your travels (travails?) through the
Java language, the packages that ship with the Java development environment
provide numerous exception classes. All of these classes are
descendants of the Throwable
class and allow programs to differentiate
between the various types of exceptions that can occur during
the execution of a Java program.
You can create your own exception classes, as well, to represent problems
that can occur within the classes that you write. Indeed, if you are a package
developer you will find that you must create your own set of exception
classes to allow your users to differentiate an error that can occur
in your package versus those errors that occur in the Java development
environment or other packages.