Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: What is the purpose of the 'finally' block in exception handling?
Answer: The 'finally' block in exception handling always executes, whether an exception is thrown or not. It is used to release resources or perform cleanup tasks.

Example:

Closing a file or database connection in the 'finally' block.
Is it helpful? Yes No

Most helpful rated by users:

©2025 WithoutBook