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 )

What are implicit Objects available to the JSP Page?

What types of comments are available in the JSP?

Interview Question: What about JSTL and JavaServer Faces ?

What is similarities/difference between an Abstract class and Interface?

Explain the new Features of JDBC 2.0 Core API?

Explain garbage collection?

Explain the Polymorphism principle.

Interview Question: How is the MVC design pattern used in Struts framework?

Interview Question: What is ActionForm?

Interview Question: What is ActionServlet?

Interview Question: Why are some of the class and element names counter-intuitive?

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

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

Interview Question: What is abstract schema?

Interview Question: What is the difference between Message Driven Beans and Stateless Session beans?

Latest Articles (in Interview)

Comment on this tutorial