wood burning stoves
The moose likes Beginning Java and the fly likes finally code not executed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "finally code not executed" Watch "finally code not executed" New topic

finally code not executed

Pranav Pal
Ranch Hand

Joined: Nov 04, 2007
Posts: 74
Under what circumstances code inside the finally block will not be executed?

Hakuna Matata!
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

When the JVM crashes or when you call System.exit().

SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Or when the code in the try-block never ends. If there's an infinite loop, for example.
Austin Lee
Ranch Hand

Joined: Feb 18, 2008
Posts: 56
If you open a thread and the thread has question leading lock.
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
Or when the try block it belongs to is never executed...

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
When you're in a daemon thread and the last non-daemon thread finishes.

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
I agree. Here's the link: http://aspose.com/file-tools
subject: finally code not executed
It's not a secret anymore!