Explain briefly about exception hierarchy in Java?

Showing Answers 1 - 4 of 4 Answers

Object class is the super  class for all the java classes.
Exceptions in Java are objects. All exceptions are derived from the java.lang. Throwable class.The two main subclasses Exception and Error constitute the main categories of throwables, the term used to refer to both exceptions and errors.
Again Exception class is super  class for checked Exceptions  and Runtime Exceptions.Except for RuntimeException, Error, and their subclasses, all exceptions are called checked exceptions. The compiler ensures that if a method can throw a checked exception, directly or indirectly, then the method must explicitly deal with it. The method must either catch the exception and take the appropriate action, or pass the exception on to its caller.Exceptions defined by Error and RuntimeException classes and their subclasses are known as unchecked exceptions, meaning that a method is not obliged to deal with these kinds of exceptions
They are either irrecoverable (exemplified by the Error class) and the program should not attempt to deal with them, or they are programming errors (examplified by the RuntimeException class) and should be dealt with as such and not as exceptions.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions