GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  J2EE  >  Core Java

 Print  |  
Question:  Please Give me an example for User defined Exception



November 11, 2005 02:46:13 #1
 N B Patil   Member Since: Visitor    Total Comments: N/A 

RE: Please Give me an example for User defined Excepti...
 
extend the Class from Exception and you can use the same for your purposewith either of the four constructors Exception() Constructs a new exception with null as its detail message.Exception(String message) Constructs a new exception with the specified detail message.Exception(String message, Throwable cause) Constructs a new exception with the specified detail message and cause.Exception(Throwable cause) Constructs a new exception with the specified cause and a detail message of (cause==null ? null : cause.toString()) (which typically contains the class and detail message of cause).MyException extends Exception { MyExeception(String msg) { super(msg); } //}
     

 

Back To Question