LearnFrenzy
Sign in Take a free test

Error Handling · Error Handling MCQ · Question 1

When finally runs Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 1 Back to Exercise

When does the finally block run?

  • A Always – after try (and catch, if it ran), even when try returns or throws Correct
  • B Only when no error occurred
  • C Only when an error occurred
  • D Only if catch is missing
Correct Answer: Option A

That is why cleanup code (closing files, hiding spinners) belongs in finally.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links