Exception Handling

Agenda

  • Introduction
    • An unexpected unwanted event that disturbs normal flow of the program is called Exception.
    • It is highly recommended to handle exceptions and the main objective of Exception handling is graceful termination of the program.
    • Exception handling doesn't mean repairing an exception. We have to provide alternative way to continue rest of the program normally. This is the concept of Exception handling.
  • Runtime stack mechanism
    • For every thread JVM will create a runtime stack. Each and every method call performed by the thread will be stored in the corresponding stack. Each entry in the stack is called stack frame or activation record. After completing, every method call the corresponding entry from the stack will be removed. After completing all method calls, the stack will become empty and that empty stack will be destroyed by JVM just before terminating the thread.
  • Default exception handling

  • Exception hierarchy
  • Customized exception handling by using try-catch
  • Control flow in try-catch
  • Methods to print exception information
  • try with multiple catch blocks
  • finally block
  • difference between final, finally, finalize
  • control flow in try-catch-finally
  • control flow in nested try-catch-finally
  • various possible combinations of try-catch-finally
  • throw keyword
  • throws keyword
  • Exception handling keywords summary
  • Various possible compile time errors in exception handling
  • Customized or user defined exceptions
  • Top-10 exceptions
    • try with resources
    • multi-catch block

Reference

  • Hello World


Comments

Popular posts from this blog

OOPS Concept in Java