This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Custom Exception doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Custom Exception doubt" Watch "Custom Exception doubt" New topic

Custom Exception doubt

Kaushik Baral

Joined: Aug 08, 2009
Posts: 23
can i create a custom exception extending java.lang.Throwable? if yes then why we do it using Exception or RuntimeException. what will be the problem if we do it using Throwable always?

thanks a lot in advance
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 38075
Because many methods only deal with Exceptions, you will have to introduce special handling for your Throwable subclass. It will count as "checked" of course.

Of course you can subclass Throwable, but that should only be done under the justification of
I only wanted to see what happens if . . .
wood burning stoves
subject: Custom Exception doubt
Similar Threads
Exception Handling in Tomcat
Exception Handling(Checked/Unchecked)
Calssic Vs Simple Custom tags
How to throw custom exceptions while implementing Provider
custom DataSource and SourceStream for RTP