Home > DeveloperSection > Interviews > If I write return at the end of the try block, will the finally block still execute?

Posted on    August-26-2014 12:00 AM

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

Sumit Kesarwani

Total Post:782

Posted on    August-26-2014 12:00 AM

Yes even if you write return as the last statement in the try block and no exception occurs, the finally block will execute. The finally block will execute and then the control return.

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

Follow MindStick