Q1
What is the purpose of the 'finally' block in Java exception handling?
mediumView Answer & ExplanationHide Answer & Explanation
Correct Answer: It contains code that always runs whether or not an exception was thrown
Explanation:
The finally block is commonly used to close resources like files or database connections, since it executes regardless of whether the try block succeeded or an exception occurred.