Exception handling : throw, throws and Throwable

throws : Used when writing methods, to declare that the method in question throws the specified (checked) exception. As opposed to checked exceptions, runtime exceptions (NullPointerExceptions etc) may be thrown without having the method declare throws NullPointerException. throw: Instruction to actually throw the exception. (Or more specifically, the Throwable). The throw keyword is followed by … Read more

Differences between Exception and Error

Errors should not be caught or handled (except in the rarest of cases). Exceptions are the bread and butter of exception handling. The Javadoc explains it well: An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions. Look at … Read more