• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

confusing!

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Question ID :960680664920
Overriding method cannot throw new exceptions that are not thrown by the overridden method.
Correct Answer:false!!!
Does it include Runtime Exceptions?
Thanks,
Rashmi
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is true only on checked exceptions.
 
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi rashmi,
An overriding method can either throw only a subset of the exceptions thrown by the overridden method or all the exceptions thrown by the overridden method or a new exception which is a subclass of the exception thrown by the overridden method.The overriding method doesn't need to throw any exceptions at all since a subset of 0 elements is a valid subset.
However, an overriding method cannot throw an exception which is the superclass of the exception thrown by overridden method.
Hence the statement is false.
Also only checked exceptions(not RuntimeException and its subclasses)need to be mentioned in the throws clause of the method if not handled by the method itself.
HTH
rajashree.

[This message has been edited by rajashree ghatak (edited November 04, 2001).]
 
Could you hold this kitten for a sec? I need to adjust this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic