🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Exceptions in Depth: all 10 questions

Quiz: Exceptions in Depth · Question 2 of 10

When does the else part of a try statement run?

When does the else part of a try statement run?

  1. A.Always, after finally
  2. B.Only when the try block raised no exception
  3. C.Only when an exception was caught
  4. D.Only when there is no finally block
Answer & explanation

Correct answer: Only when the try block raised no exception

else is the "it worked" branch.

Can you get the rest right without peeking?

Take the timed Quiz: Exceptions in Depth quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →