File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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!