This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Overriding and Exceptions

 
Deepali Pate
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Someone clarify to me if this is right.
Overridden methods cannot add new checked exceptions.
But is it right that when it is overriding a abstract method it can add new checked exceptions.
 
Jamal Hasanov
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Deepali
Abstract method can be implemented, not overridden...
Jamal Hasanov
www.j-think.com
 
Deepali Pate
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well ya thats right thnx for correcting my blunder.
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Overridden methods cannot add new checked exceptions.

Yes.

But is it right that when it is overriding a abstract method it can add new checked exceptions.

No. See below:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic