This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Question: what are you allowed to declare as an exception type in <exception-type>??Answer:
Anything that's throwable so that includes java.lang.Error,runtime exceptions, and any checked exception(as long as the checked exception class is on the Container's classpath,of course)
The <exception-type> requires the full class name of the Throwable type, which we want to catch by this mechanism. As the type is "Throwable" we can catch Errors, Run-time Exceptions and Checked Exception. Checked Exceptions are ususlly declare in the method defination throws clause, if you want to propogate the exceptions to the outer world (i.e to Exception handling mechanism).
any checked exception(as long as the checked exception class is on the Container's classpath
If it is required to define custom exceptions for exception handling the user usullay define the checked exceptions. So these checked exception clsses must be accessible to container , so it should be in the container's classpath. If the containe can not find Exception class it will be error.