This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft 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 Java 8 in Action this week in the Java 8 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
Similar Threads
Getting error in setupConnection()
problem in retreiving value
WA #1.....word association
Regarding tomcat
print statement in the declaration ...