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 )

Latest Articles (in Interview)