File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes How to classify an exception as checked or unchecked? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to classify an exception as checked or unchecked?" Watch "How to classify an exception as checked or unchecked?" New topic
Author

How to classify an exception as checked or unchecked?

Ajay Xavier
Ranch Hand

Joined: Jan 03, 2005
Posts: 109
Hi,

Thanks for every one who gave their veiws on my last query.(Throwing a null value from a method)

How to classify an exception as a checked one or unchecked one? To be more precise how do i decide the superclass (Exception or RuntimeException) of my custom exception?

Thanks,
Ajay.
Chetan Raju
Ranch Hand

Joined: Aug 02, 2006
Posts: 109
All exception classes that extend the RuntimeException class are said to be unchecked exceptions. This means the compiler doesn't check the RuntimeExceptions. So if you want to create a checked exception then extend your class with Exception class.

Also, the Error class and subclasses of Error are also unchecked by compiler.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to classify an exception as checked or unchecked?
 
Similar Threads
JVM Thrown Exceptions/Programmatically thrown exceptions
Checked and Unchecked exceptions
how to remember all checked and unchecked exception
Exception
How can we identify checked and Unchecked exceptions ?