🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Error Handling and Debugging: all 10 questions

Quiz: Error Handling and Debugging · Question 10 of 10

What is finally best used for?

What is finally best used for?

  1. A.Handling only syntax errors
  2. B.Clean-up that must happen whether or not an error occurred, such as hiding a spinner
  3. C.Retrying the try block
  4. D.Declaring variables for catch
Answer & explanation

Correct answer: Clean-up that must happen whether or not an error occurred, such as hiding a spinner

finally runs in both the success and the failure path.

Can you get the rest right without peeking?

Take the timed Quiz: Error Handling and Debugging quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →