2017  Kodetalk | Feedback | Privacy Policy | Terms | About

when does finally block code does not get executed?

finally block failed to  excute ,why?

If any code is executed ,then finally block is guaranteed to be executed regardless of whether any catch block is executed .finally block can be used to specify any clean up code.

                     finally block is not executed ,if we put System.exit(0); in try block because the try block code doesn't excecute which is mandatory for the execution of finally block code. 


Answer is