File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes User-defined Exception class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "User-defined Exception class" Watch "User-defined Exception class" New topic

User-defined Exception class

mi te

Joined: Mar 09, 2006
Posts: 29
Could you read the following code below?

This runs ok, but I wanted to make sure this the prefered way of writing a user-defined exception class. The question I am asking is that is it better not to override the method getMessage() of Exception class?

Please someone be kind and reply.

[ March 13, 2006: Message edited by: Mark Spritzler ]
[ March 13, 2006: Message edited by: Mark Spritzler ]
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Looks much easier to read when I put in the CODE tags, that you can put in when you click the CODE button under the Add Reply button when posting messages on this board.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
Greg Charles

Joined: Oct 01, 2001
Posts: 2962

I would say there's no particular reason to override getMessage(), so why do it?
mi te

Joined: Mar 09, 2006
Posts: 29
Yeah, to be honest why I bothered overriding.... I ought t o have a strong cup of coffee.
I agree. Here's the link:
subject: User-defined Exception class
jQuery in Action, 3rd edition