• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Exception

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Friends
I wanted to the rules of throwing Exceptions when yoy override methods
and why so.
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Friend,
Hope i can help u in this.
Overridden is done to override the method of the base class and overridden with exception have certain rule.
1. if the base class method has thrown any exception the overridden method can throws that exception or subclass of that exception. this rule apply to only checked exception and not to unchecked exception.
2. If the base class method had throws more than one exception like class xyz throws A,B,C then overridden method can throws anyone of these set of exception in subclass.
1. A
2. B
3. C
4. A,B
5. B,C
6. A,C
7. it can neither throw any exception.
i hope i am right and ur doubt is also clear upto certain limit.
 
reply
    Bookmark Topic Watch Topic
  • New Topic