This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Relationship between Exceptions [Tricky]

 
Ashish Agrawal
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Will this code give any compile time error? Why?



Thanks,
Ashish Agrawal
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ashish Agrawal
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe this will help.

http://www-2.cs.cmu.edu/~pattis/15-1XX/15-200/lectures/exceptions/lecture.html

Regards,
Ashish A
[ April 12, 2005: Message edited by: Ashish Agrawal ]
 
challa
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ashish,

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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic