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.
Hold on a second...
It isn't both checked and unchecked
The unchecked exceptions classes are the class RuntimeException and its subclasses, and the class Error and its subclasses. All other exception classes are checked exception classes.
is Throwable a RuntimeException or one of its subclasses? No
is Throwable an Error or one of Error's subclasses ? No
if you do as Ankit suggested and try to throw an unchecked throwable, it won't compile
Joined: Oct 30, 2009
Throwable is super class of RuntimeException and Error so it contains them too, thats why when you throw a throwable you can catch it or not as per your wish.
If you dont catch a throwable compiler will not complain which is the case with RuntimeExceptions and Errors.
Throwable is superclass of all Exceptions, so it contains both checked and unchecked exceptions.