This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Custom Exception doubt" Watch "Custom Exception doubt" New topic
Author

Custom Exception doubt

Kaushik Baral
Greenhorn

Joined: Aug 08, 2009
Posts: 23
hi,
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
Sheriff

Joined: Oct 13, 2005
Posts: 38472
    
  23
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 . . .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Custom Exception doubt