This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Relationship between Exceptions [Tricky]  RSS feed

 
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!