OCA Java SE 8 Exception - OCA Mock Question Exception 7








Question

When are you required to use a finally block in a regular try statement not a try-with-resources?

  1. Never.
  2. When the program code cannot exit on its own.
  3. When there are no catch blocks in a try statement.
  4. When there is one catch block in a try statement.
  5. When there are two or more catch blocks in a try statement.




Answer



C.

Note

A try statement is required to have a catch clause and/or finally clause.

catch can have multiple catch clauses.