File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Java in General
Bookmark "Exceptions and Errors" Watch "Exceptions and Errors" New topic

Exceptions and Errors

Tan Richards

Joined: Sep 29, 2005
Posts: 18
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

Joined: Sep 29, 2005
Posts: 18
Thanx for the explanation Seb.
I agree. Here's the link:
subject: Exceptions and Errors
It's not a secret anymore!