Why should we extend Exception instead of Throwable?

We usually extend Exception instead of Throwable. Why? In what situations we extend Throwable.
Could anybody give the answer in detail. Thanks in advance.

Questions by svk_viza

Showing Answers 1 - 2 of 2 Answers

rariedel

  • May 27th, 2008
 

Extending the Exception class (a descendant of Throwable) instead of extending Throwable itself is a programming convention, not a requirement.

Like most conventions, following the convention lends consistency to the end result.

By extending Throwable, you are giving hook for RuntimeException and programmers normally do not catch unchecked exceptions.  

However, if you have an app server and want to ensure that the server is not brought down by some unchecked exceptions you may want to use the extension of Throwable.

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