What does the following code do? try { // code } catch (Exception e) {} finally {}

  1. Only executes if exception occurs
  2. Executes regardless of exception
  3. Only runs finally block
  4. Throws compile error
Correct answer Executes regardless of exception

Explanation

The `finally` block always executes after try-catch.

Update: Admin added a tag on this question

Topics

By Admin · · 27 views