← Quiz: Java Exception Handling: all 10 questions
Quiz: Java Exception Handling · Question 9 of 10
When does a finally block NOT run?
When does a finally block NOT run?
- A.When the catch block throws a new exception
- B.When the try block has a return statement
- C.When no exception occurs
- D.When System.exit() is called inside try (or the JVM crashes)
Answer & explanation
Correct answer: When System.exit() is called inside try (or the JVM crashes)
finally runs in all normal cases, including return and exceptions, but System.exit stops the JVM immediately.
Can you get the rest right without peeking?
Take the timed Quiz: Java Exception Handling quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →