Home > DeveloperSection > Interviews > If I write System.exit(0); at the end of the try block, will the finally block still execute?

Posted on    August-26-2014 12:01 AM

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

Sumit Kesarwani

Total Post:782

Posted on    August-26-2014 12:00 AM

No. In this case the finally block will not execute because when you say System.exit(0); the control immediately goes out of the program, and thus finally never executes.

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

Follow MindStick