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!