Multiple choice technology programming languages

In the above code, the call to the factorial() throws StackOverflowException. Will the finally block gets executed and prints the "finally" message to the user?

  1. Yes

  2. No

  3. May be

  4. I don't know

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

When a StackOverflowException occurs, the process is terminated immediately because the stack is corrupted. Unlike most exceptions, finally blocks do NOT execute for StackOverflowException. This is because there's no stack space left to execute the finally block - the runtime cannot safely continue execution.