When does the finally clause of a try statement execute?
Correct answer D. Always, whether or not an exception occurred in the try block
Explanation
finally runs as the last task before the try statement completes, whether the try block finished normally, an exception was handled, an exception is propagating, or a return, break or continue left the block. That makes it the right place for clean-up such as closing files or releasing locks.
Answer checked How we write and check questions
Discussion