What is the 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 the finally block?
Rating:
A block of code that appears just after the finally statement is called a finally block. The statements in a finally block are executed immediately after execution of the try/catch block. The finally block is optional. However, each try statement must have at least one catch block or a finally block. When a finally block is defined in a source code, it is guaranteed to execute, regardless of whether or not an exception is thrown.
Rating:
Was this information helpful?
Other articles
- Java Control Statements
- What is the wait() method?
- What is the finalize() method?
- What is optimization?
- What are final variables?