Home | Add to Favorites | Ebooks Directory | News  
Java Programming
Home
Java  Article
Java Tutorial 
Java download
Books
JDBC
Java Training
Java Source  Code
Java Applet
Java Questions
Java Exception Handling Sample Program

This Prgram Explanins about how to create own exceptions and how to handle them


 


This is a simple Java program explains about Exception Handling

Visit Java Article part to find more java programs



 

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";
}
}