Thursday, April 29, 2010

finally block not executed

Finally block is always executed except some of the following cases.
  • If the JVM exits while the try or catch code is being executed, then the finally block may not execute. 
          e.g. System.exit(0);
  • If the thread executing the try or catch code is interrupted or killed, the finally block may not execute even though the application as a whole continues. 
         e.g. Thread.interrupted();


No comments:

Post a Comment