File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Error vs. Exception" Watch "Error vs. Exception" New topic
Author

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.
Thanks,
Drew
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.
 
Consider Paul's rocket mass heater.
 
subject: Error vs. Exception