Home > DeveloperSection > Interviews > What is the importance of finally block in exception handling ?

Posted on    January-14-2015 10:28 PM

 Java Java 
 1 Answer(s)
  756  View(s)
Rate this:

Kamlakar Singh
Kamlakar Singh

Total Post:80

Posted on    January-14-2015 11:28 PM

A finally block will always be executed, whether or not an exception is actually thrown. Even in the case where the catch statement is missing and an exception is thrown, the finally block will still be executed. Last thing to mention is that the finally block is used to release resources like I/O buffers, database connections, etc.

Don't want to miss updates? Please click the below button!

Follow MindStick