Java Reference
In-Depth Information
The java.lang.Throwable class is the parent class of all exceptions. It has
two child classes: java.lang.Exception and java.lang.Error.
■■
There are two types of exceptions: runtime exceptions and checked
exceptions. Runtime exceptions are those exceptions that are child
classes of java.lang.RuntimeException. All other exceptions are checked
exceptions.
■■
A try block can have any number of corresponding catch blocks. A try
block can also contain a finally block that executes whether or not an
exception occurs.
■■
The throws keyword is used to declare that a method throws an
exception.
■■
The throw keyword is used to throw an exception.
■■
A child class method that overrides a parent class method cannot
declare that it throws more exceptions than the parent class method.
■■
A user-defined exception must extend the java.lang.Throwable class,
although typically it will extend either the Exception or Runtime-
Exception class.
■■
Search WWH ::




Custom Search