Question OOP-EXC-0003
EasyWhen does a finally block run?
- A.
Never
- B.
Only when no exception occurs
- C.
Show answer and explanation
Answer: C
It's used for clean-up such as closing files. (Only extreme cases like System.exit() skip it.)
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Exception Handling question
When does a finally block run?
Never
Only when no exception occurs
Answer: C
It's used for clean-up such as closing files. (Only extreme cases like System.exit() skip it.)
Always, whether or not an exception occurs
Only when an exception occurs