File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is the differance between java errors and Exception

 
arun mahajan
Ranch Hand
Posts: 305
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3244
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic