Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exceptions and Errors

 
Tan Richards
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Seb Mathe
Ranch Hand
Posts: 225
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tan Richards
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx for the explanation Seb.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic