← Quiz: Java Interview Questions: all 10 questions
Quiz: Java Interview Questions · Question 4 of 10
When does the finally block NOT run?
When does the finally block NOT run?
- A.When an exception is caught
- B.When there is a return in try
- C.When System.exit() is called in try
- D.Never — it always runs
Answer & explanation
Correct answer: When System.exit() is called in try
System.exit stops the JVM, so finally is skipped. A return still runs finally first.
Can you get the rest right without peeking?
Take the timed Quiz: Java Interview Questions quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →