Just a simple query this.If I have a try catch finally block.I know the statement that the finally block is always executed no matter what.But I am also aware that the finally block does not get executed if there is a System.exit(0). I just want to know when does the finally block fail to execute: 1)When the System.exit(0) is in the try block OR 2)When the System.exit(0) is in the catch block.
A silly question this but I want to know the answer immediately and I can't write a simple code to test right now.
1)When the System.exit(0) is in the try block before an execption is thrown then Catch and Finally block will not be executed. 2) When the System.exit(0) is in the Catch block then Finally block will not be executed.
Originally posted by Nikhil Sun: ...I want to know the answer immediately and I can't write a simple code to test right now.
Are you working on a machine that does not have a JDK installed?
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Joined: Nov 13, 2005
Hey Marc I am not working/practising from home.Atleast not yet.And I don't havejdk installed on my system either .I was just reading up some articles and wanted to know some simple things like the topic I have posted.