• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

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
  • 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: 21783
103
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • 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
  • 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: 3313
31
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator

Thanks Mike.
 
Don't mess with me you fool! I'm cooking with gas! Here, read this tiny ad:
Enterprise-grade Excel API for Java
https://products.aspose.com/cells/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!