aspose file tools*
The moose likes Beginning Java and the fly likes What is the differance between java errors and Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What is the differance between java errors and Exception" Watch "What is the differance between java errors and Exception" New topic
Author

What is the differance between java errors and Exception

arun mahajan
Ranch Hand

Joined: Dec 07, 2001
Posts: 305
Hello,
What is the differance between java errors and Exception? when one can catch them and how? any code snippet please.
regards,
arun
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
arun
Both Error and Exception are subclaasses of throwable and so can be caught in a catch statement.
The biggest difference is that the Error classes are all considered to be "...serious problems that a reasonable application should not try to catch." Thus they are all considered 'unchecked' exceptions, meaning you do not have to account for them in your code and the compiler will not look for them.
On the other hand all subclasses of Exception (except RuntimeException) are checked Exceptions that must either be thrown from or caught in methods that can produce them. The compiler will check and enforce proper handling of these types of methods.
Check out the part of the java tutorial that covers exceptions for more info.
hope that helps


Dave
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is the differance between java errors and Exception