What is a finally block?
Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.
What is a finally block?
Rating:
A finally block is used to execute a certain portion of code that must be executed, irrespective of whether or not an exception is caught. Even if a catch block is not found, a try block can still be used with a finally block. It allows a programmer to avoid having cleanup code accidentally bypassed by a return, continue, or break statement. A finally block does not execute only when a System.exit() statement is encountered or the program terminates due to an error.
Rating:
Was this information helpful?
Other articles
- What are the differences between method overriding and method overloading?
- What is the intValue() method?
- What are the data type conversions available in Java?
- What is the finalize() method?
- Skills required for Sun test CX310-065