Exception handling keyword summary
try:- To maintain risky code.
catch:- To maintain exception handling code.
finally:- To maintain cleanup code.
throw:- To handover our created exception object to JVM manually.
throws:- To delegate responsibility of exception handling to the caller.
Various possible compile time error in exception handling.
- Unreported exception xxx must be caught or declared to be thrown.
- Exception xxx has already been caught.
- Exception xxx is never thrown in body of corresponding try statement.
- Unreachable statement.
- Incompatible type.
- found : test
- required: java.lang.Throwable
- try without catch or finally.
- catch without try.
- finally without try.
Related topic
- Exception handling in java
- Exception hierarchy
- Customized exception handling by try-catch
- Difference between final, finally and finalize
- throw and throws keyword
- Exception handling keyword
- Custom exception in java
- Top 10 exception in java