IF I WRITE SYSTEM.EXIT (0); AT THE END OF THE TRY BLOCK, WILL THE FINALLY BLOCK STILL EXECUTE?

Sumit Kesarwani

Total Post:782

Points:3910
Posted by  Sumit Kesarwani
 1106  View(s)
Ratings:
Rate this:
  1. Sumit Kesarwani

    Post:782

    Points:3910
    If I write System.exit (0); at the end of the try block, will the finally block still execute?

    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.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!