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 )

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

What are the services provided by a J2EE container?

What is difference between Java Bean and Enterprise Java Bean?

What is transient variable?

The output of System.out.println(5>>2) in Java

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

Question: How would you go about analyzing performance of an application?

What is JAXP?

Interview Question: What about JSTL and JavaServer Faces ?

Interview Question: Why aren't the Struts tags maintained as part of the Jakarta Taglibs project ?

Name the containers which uses Border Layout as their default layout?

Interview Question: Is Struts compatible with other Java technologies?

What are the life-cycle methods of JSP?

What is JSP declaration?

What do you understand by a J2EE module?

Latest Articles (in Interview)