wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Must subclasses implement interfaces that their super-classes implement? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Must subclasses implement interfaces that their super-classes implement?" Watch "Must subclasses implement interfaces that their super-classes implement?" New topic
Author

Must subclasses implement interfaces that their super-classes implement?

Jed Cousin
Greenhorn

Joined: Dec 08, 2004
Posts: 3
If I create sub-class 'bar' that extends class 'foo', and class foo implements interface 'baz', must sub-class bar also implement interface baz?
Jimmy Die
Ranch Hand

Joined: Nov 20, 2003
Posts: 97
Hi,



No.

Bar will extend the methods you implemented in foo (and the ones you did not provide implementations for if any). If you did not provide concrete implementations of the methods from baz in foo, then foo is abstract. If bar doesn't provide concrete implementations of these methods then bar will also be abstract.


Jimmy Die
Jed Cousin
Greenhorn

Joined: Dec 08, 2004
Posts: 3
Ah, so baz becomes an integral part of foo (or bar) once the interface's abstract methods are made concrete. Thus obviating the need for a subclass (bar) to implement a superclass' interface (baz), as it's already been 'Borg-ed' by the superclass (foo).

Thanks man!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Must subclasses implement interfaces that their super-classes implement?