File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes What does checled exception mean? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "What does checled exception mean?" Watch "What does checled exception mean?" New topic

What does checled exception mean?

Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 751
I'm playing the Java Rule Round Up Game

SCJP 1.5
Dale DeMott
Ranch Hand

Joined: Nov 02, 2000
Posts: 515
A checked exection is any exception that is expected to be handled by the developer. If your compiler complains that an exception isn't handled in your code, then the exception you aren't handling is a checked exception. The compiler is 'checking' to see if you handled it in your code. Runtime exceptions are not checked. The compiler doesn't EXPECT you to handle them however you can catch them if you want.

By failing to prepare, you are preparing to fail.<br />Benjamin Franklin (1706 - 1790)
Hemant Agarwal
Ranch Hand

Joined: Nov 21, 2005
Posts: 138
Is it possible to create RunTime Exceptions in my code?
Michael Duffy
Ranch Hand

Joined: Oct 15, 2005
Posts: 163
Originally posted by Hemant Agarwal:
Is it possible to create RunTime Exceptions in my code?

of course, just have your exception extend java.lang.RuntimeException

Mike Noel
Ranch Hand

Joined: Dec 15, 2005
Posts: 108
Or you can throw a RuntimeException with:

It's probably more useful to throw one of the RuntimeException subclasses like the UnsupportedOperationException.


Mike Noel
I agree. Here's the link:
subject: What does checled exception mean?
It's not a secret anymore!