View RSS Feed

Java Exception

User defined exception

Rate this Entry
by , 01-08-2012 at 12:01 PM (1151 Views)
You can customize and write your own user defined exceptions. Following class extends the Exception class and writes a new “MyException” which is thrown at some point in your code.

Java Code: This is an example of user defined exception
public class MyException extends Exception {
/* class definition of constructors goes here */
public MyException() {
super();
}
public MyException (String errorMessage) {
super (errorMessage);
}
}

Submit "User defined exception" to Facebook Submit "User defined exception" to Digg Submit "User defined exception" to del.icio.us Submit "User defined exception" to StumbleUpon Submit "User defined exception" to Google

Updated 01-14-2012 at 06:48 PM by Java Exception

Tags: exception Add / Edit Tags
Categories
Tutorial

Comments