This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Exceptions and Errors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Exceptions and Errors" Watch "Exceptions and Errors" New topic
Author

Exceptions and Errors

Tan Richards
Greenhorn

Joined: Sep 29, 2005
Posts: 18
Hi,
While going through exception handling this question has come to my mind. Can anyone please answer them?

Why some cases are defined as exceptions ansd some as Errors in Java?
What are there representation from the system's point of view?
Why we are not allowed to handle Errors like exceptions in java?


"Failures are pillars of success" - That doesn't mean you go on building pillars
Seb Mathe
Ranch Hand

Joined: Sep 28, 2005
Posts: 225
You can handle Errors as you can handle Exceptions (both classes extends Throwable, and you can catch Throwables).

But an Error as a particular mining ; From the Javadoc ""An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions. ... A method is not required to declare in its throws clause any subclasses of Error that might be thrown during the execution of the method but not caught, since these errors are abnormal conditions that should never occur.


Regards,<br />Seb<br /> <br />SCJP 1.4
Tan Richards
Greenhorn

Joined: Sep 29, 2005
Posts: 18
Thanx for the explanation Seb.
 
 
subject: Exceptions and Errors
 
Similar Threads
What was the need of exceptions classifications?
Runtime Exception
NoSuchMethodException
wrapper
unreachable statement again