This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
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

Win a copy of Elasticsearch in Action this week in the Big Data forum!
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.
jQuery in Action, 2nd edition
subject: Relationship between Exceptions [Tricky]