🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.When an exception is caught
  2. B.When there is a return in try
  3. C.When System.exit() is called in try
  4. 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 →