File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Checked Exceptions Vs RuntimeException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Checked Exceptions Vs RuntimeException" Watch "Checked Exceptions Vs RuntimeException" New topic
Author

Checked Exceptions Vs RuntimeException

manasa teja
Ranch Hand

Joined: May 27, 2002
Posts: 325
Can any please explain me the difference between Checked Exceptions and java.lang.RuntimeException with nice examples.
thanks
murthy


MT
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Murthy
there are two type of exceptions, checked and unchecked. The checked exception are all of the exceptions that extend Exception, except RuntimeException and is subclasses. RuntimeException and it sublclasses along with Error and its subclasses are all considered unchecked exceptions.
The checked vs unchecked part comes from what the compiler does. In a checked exception the compiler will check to make sure that the exception is used properly and caught/handled properly. They are checked exceptions becasue it si reasonable assumed that the exceptional condidtion can and should be found and fixed by the programmer not by the end user.
The unchecked exception is just the opposite it is assumed that are caused by conditions over which the programmer has no control , a lost connection, out of memory, etc.
hope that helps out a little


Dave
Jamal Hasanov
Ranch Hand

Joined: Jan 08, 2002
Posts: 411
Hi, Murthy
Sometimes use search for getting fast answer.. I searched "checked" keyword and got a lot of useful thread links.
I can suggest this thread to you.
regards,
Jamal Hasanov
www.j-think.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Checked Exceptions Vs RuntimeException