Try-catch

Try-catch-finally may happen whenever an exception is raised and how the control flow occurs in each of the given cases.

  1. Control flow in try-catch clause OR try-catch-finally clause
    1. Case 1: Exception occurs in try block and handled in catch block
    2. Case 2: Exception occurs in try-block is not handled in catch block
    3. Case 3: Exception doesn't occur in try-block
  2. try-finally clause
    1. Case 1: Exception occurs in try block
    2. Case 2: Exception doesn't occur in try-block