File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Relationship between Exceptions [Tricky] 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 "Relationship between Exceptions [Tricky]" Watch "Relationship between Exceptions [Tricky]" New topic

Relationship between Exceptions [Tricky]

Ashish Agrawal
Ranch Hand

Joined: Nov 02, 2003
Posts: 112
Will this code give any compile time error? Why?

Ashish Agrawal
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
You could answer the first question by actually trying to compile it, couldn't you? That would certainly help in one's quest for understanding.

"I'm not back." - Bill Harding, Twister
Ashish Agrawal
Ranch Hand

Joined: Nov 02, 2003
Posts: 112
Maybe this will help.

Ashish A
[ April 12, 2005: Message edited by: Ashish Agrawal ]

Joined: Mar 28, 2005
Posts: 23

A method overrided in subclass can throw the checked exceptions or its subclasses thrown by the method in the super classes or it need not throw any exception. This rule is not applicable to unchecked exception.

In your code classnotfoundexception is a checked exception and runtime exception is unchecked exception.

hope it is clear.
I agree. Here's the link:
subject: Relationship between Exceptions [Tricky]
It's not a secret anymore!