Java - Things to know before OCJP exam - Exceptions

1. ArithmeticException is the subclass of RuntimeException and is an unchecked exception.

2. * Compiler gives error if we don't handle checked exceptions whereas unchecked exceptions are optional to be handled.

3. Either we should catch the checked exceptions or the method should be declared to throw those exceptions.

4. * Catch blocks for try should handle exceptions from specific to general. Compiler gives error if we have generalize catch before specific.

5. * Finally block is always executed whether an exception occurs or not.

6. * When an exception is thrown, rest statements in the try block are not executed.

7. try and then finally without catch is legal in java.

8. try without catch or finally is not legal.

9. * An overriding method cannot throw an exception wider than the exception being thrown from the overriden method.