This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Error vs. Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Error vs. Exception" Watch "Error vs. Exception" New topic

Error vs. Exception

Drew Lane
Ranch Hand

Joined: May 13, 2001
Posts: 296
If an error is caught, is the finally method guaranteed to be called or is this only true with exceptions?
Also, would an error cause a Thread to stop running?
I'm mainly referring to java.lang.OutofMemoryError.
Ray Stojonic
Ranch Hand

Joined: Aug 08, 2003
Posts: 326
In JLS �14.19.2 they use 'completes abruptly' instead of the terms 'error' and 'exception', which leads me to believe that, yes, the finally block will be executed on any 'interuption' in its companion try block.
I agree. Here's the link:
subject: Error vs. Exception
It's not a secret anymore!