Results 1 to 3 of 3
- 02-11-2011, 08:47 AM #1
How to Extend an Exception in Java (InputMismatchException) ?
Hi ..
Am Trying to Customize this Class (InvalidGradeException) to Print A Simple Message When the Exception Handled. Actually I had Try to Do it With Constructor but Cannot. Can you Help me ?
As you see the Class Inherits From the Exception Class (InputMismatchException).
HatemJava Code:Class InvalidGradeException extends InputMismatchException { }
- 02-11-2011, 08:52 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,418
- Blog Entries
- 7
- Rep Power
- 17
Implement a couple of constructors in your class (that call the superclass' constructors) like this:
kind regards,Java Code:public class InvalidGradeException extends InputMismatchException { public InvalidGradeException() { super(); } public InvalidGradeException(String s) { super(s); } // other interesting stuff here ... }
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 02-11-2011, 09:03 AM #3
Similar Threads
-
help instantiate a java class that extend applet
By geosa in forum Java AppletsReplies: 0Last Post: 12-04-2010, 09:14 AM -
try-catch InputMismatchException in a while loop
By themulator in forum New To JavaReplies: 17Last Post: 10-12-2010, 04:49 AM -
Extend Jscroll
By cowboy in forum New To JavaReplies: 10Last Post: 12-13-2009, 08:07 PM -
How can I extend java.net.URI - why is it final?
By johann_p in forum Advanced JavaReplies: 1Last Post: 08-21-2009, 05:31 AM -
using J-classes or extend them ?
By itaipee in forum AWT / SwingReplies: 1Last Post: 01-01-2009, 07:58 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks