• 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Overridden method is throwing 2 or more unchecked exceptions How about the overidden method exceptns

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the method signature which looks like below



I want to override this method .Please, let me know the restrictions on the throws list(Exception list) of the overidden method.I want to know the possible combination of throws exceptions of the overiding method.
 
Sheriff
Posts: 22683
128
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which exceptions you can and cannot throw from a method is a beginner's topic. Moving.
 
Anwar Hussain
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Prime wrote:Which exceptions you can and cannot throw from a method is a beginner's topic. Moving.



Hi ,

This is relatec to overriding. so it should not be moved.
 
Master Rancher
Posts: 4280
57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, I think it's still a beginner topic. Overriding is pretty fundamental in Java; you can't advance without knowing how it works. I'm not saying it's easy, necessarily. But it is a requirement for beginners to understand. Even if the overridden method throws an exception.

Do you understand checked exceptions? Basically, your overriding method cannot throw any new checked exceptions. You can throw any unchecked exception you want, and you can throw anything that was declared in the overridden method's throws statement, or any subclass of what was declared there. You can also throw less than was declared there. Your overriding method may even throw no checked exceptions at all - and thus, it has no need to declare anything.
 
Anwar Hussain
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanks Mike.
 
He's giving us the slip! Quick! Grab this tiny ad!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic