public class ExceptionHandling {
/** Creates a new instance of ExceptionHandling */
public ExceptionHandling() {
}
public static void main(String a[]){
try{
OwnException own=new OwnException();
throw own;
}
catch(OwnException e){
System.out.println(e);
System.out.println("exception" +e.getMessage());
}
}
}
class OwnException extends Exception{
OwnException(){
super("OwnWxception");
}
public String toString(){
return "MyException";
}
}
|