• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

interface : Bug in K&B P-115

 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Friends,
At Page - 115 :

So don't be fooled by code that shows a concrete class that declares that it implements an interface, but doesn't implement the methods of the interface. Before you can tell whether the code is legal, you must know what the superclasses of this implementing class have declared. If any class in its inheritance tree has already provided concrete (i.e., non-abstract) method implementations, and has declared that it (the superclass) implements the interface, then the subclass is under no
obligation to re-implement (override) those methods.

The line in bold is not correct. This line should be :
and irrespective of it has declared that it (the superclass) implements the interface or not


 
Matt Russell
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Logically, the K&B statement is correct (as is yours), and it is not (IMO) even misleading...no reader would be tempted to believe that if a superclass does not declare that it implements an interface, then the subclass is obliged to provide implementations for the interface methods!
 
Venkat Sidh
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sandeep,

Bert has already fixed this point. Please refer Bert's K & B, SCJP 5 - Errata: Updated 7/28/06.
 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic