Programming Tutorials

Explain the user defined Exceptions?

By: Karthik in Interview Tutorials on 2012-06-16  

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 
}





Add Comment

* Required information
1000

Comments

No comments yet. Be the first!

Most Viewed Articles (in Interview )

Interview Question: Write code of any Action Class?

What is expression in JSP?

Interview Question: What is EJB container?

Interview Question: What is the difference between JavaBean and EJB?

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

Interview Question: If the framework doesn't do what I want, can I request that a feature be added?

Question: Explain the life-cycle methods in JSP?

Question: What is a Hidden Comment in JSP?

Explain the user defined Exceptions?

Explain the different forms of Polymorphism.

Interview Question: What is deployment descriptor?

What are Access Specifiers available in Java?

Explain the Polymorphism principle.

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

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

Latest Articles (in Interview)