Java Tutorial · Revision notes

Java Exception Handling

An exception is an event that disrupts normal program flow. Java handles it with try, catch, finally, throw and throws. This chapter also covers custom exceptions and the difference between checked and unchecked exceptions.

Quick revision

  • Throwable → Error / Exception → RuntimeException
  • try needs catch or finally; catch specific before general
  • finally runs always except System.exit; return in finally overrides
  • throw = raise one object; throws = declare in signature
  • Custom: extends Exception (checked) or RuntimeException (unchecked)
  • Checked = compile-time enforced; Unchecked = RuntimeException + Error
Read the full Java Exception Handling notes on Doubtclip →