Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Overriding and Exceptions  RSS feed

 
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
Boost this thread!