Explain the user defined Exceptions?

By: Karthik Printer Friendly Format    

Answer: User defined Exceptions are the separate Exception classes defined by the user for specific purposed. An user defined can created by simply sub-classing it to the Exception class. This allows custom exceptions to be generated (using throw) and caught in the same way as normal exceptions.

Example:

class myCustomException extends Exception {
     // The class simply has to exist to be an exception 
}




Most Viewed Articles (in Interview )

Why J2EE is suitable for the development distributed multi-tiered enterprise applications?

Interview Question: Is Struts compatible with other Java technologies?

What is the difference between Session Bean and Entity Bean?

Interview Question: What is difference between EJB 1.1 and EJB 2.0?

Interview Question: What is the difference between EAR, JAR and WAR file?

Interview Question: What is abstract schema?

Question: What is an output comment in JSP?

What is Collection API?

Interview Question: What is Struts Validator Framework?

Interview Question: How does Struts work?

Interview Question: What is Remote client view?

Interview Question: Can I invoke Runtime.gc() in an EJB?

Interview Question: Why does EJB needs two interfaces(Home and Remote Interface)?

Interview Question: What is the difference between ejbCreate() and ejbPostCreate?

Interview Question: What is the difference between sessioncontext and entitycontext?

Latest Articles (in Interview)

Comment on this tutorial