View Havish  Goswami 's Profile
What is the use of the finally block? Is finally block in Java guaranteed to be called? When finally block is NOT called?
Hi Java Professionals,

Please elaborate the answer
Asked by Havish Goswami | Jun 16 2018 | Report this Report abuse
Replies (7)
View Tanya  Sharma 's Profile
Java finally block is a block that is used to execute important code such as closing connection, stream etc

Visit this helpful article to better understand

https://www.mindstick.com/Articles/12106/exception-handling-in-java-guidelines-on-the-use-of-finally-block

http://www.java-samples.com/showtutorial.php?tutorialid=296
Jun 22 2018 | Report this Report abuse
View Shatish  Rao 's Profile
Java finally block is a block that is used to execute important code such as closing connection, stream etc

Visit this helpful article to better understand

https://www.mindstick.com/Articles/12106/exception-handling-in-java-guidelines-on-the-use-of-finally-block

http://www.java-samples.com/showtutorial.php?tutorialid=296
Jun 22 2018 | Report this Report abuse
View Chinmay  Hegde 's Profile
Finally block is used to Irrespective of Exception i need to do some logic .i will place such logic into finally block.
finally block always execute except one condition that is if u r placing System.exit(0)

Ex:connection.close()
Jun 22 2018 | Report this Report abuse
View Shatish  Rao 's Profile
Finally block is used to Irrespective of Exception i need to do some logic .i will place such logic into finally block.
finally block always execute except one condition that is if u r placing System.exit(0)

Ex:connection.close()
Jun 21 2018 | Report this Report abuse
View Nirupama  Pathak 's Profile
Finally block is used if there is code that must be executed regardless of whether the exception is thrown or not.In the Finally block,clean up code related to closing of database connections,closing of files is written.

Finally block is not called in the conditions mentioned in the above post.
Jun 21 2018 | Report this Report abuse
View Nirupama  Pathak 's Profile
Finally block is used if there is code that must be executed regardless of whether the exception is thrown or not.In the Finally block,clean up code related to closing of database connections,closing of files is written.

Finally block is not called in the conditions mentioned in the above post.
Jun 20 2018 | Report this Report abuse
View Roshan  shah 's Profile
finally block is used to perform clean-up activities or code clean-up like closing database connection & closing streams or file resources, etc

http://www.benchresources.net/finally-block-in-java-exception-handling/

http://www.benchresources.net/return-statement-with-finally-block-in-java/
Jun 20 2018 | Report this Report abuse