Reputation: 111
just a little question that can be stupid but i want to be sure of this. If i got 2 classes: ClassA and ClassB declared in this way
public ClassA implements Usable... //Usable is an interface obviously
...
public ClassB extends ClassA ...
...
Does ClassB implement Usable?
EDIT And if the answer is yes if i ll write this declaration below
public ClassB extends ClassA implements Usable
what will happen ? eclipse doesn't show me errors but i want to know if there will be in some way
Upvotes: 0
Views: 54
Reputation: 11487
public ClassB extends ClassA implements Usable
is equivalent to just
public ClassB extends ClassA
. As you have already extended ClassA
which implements all methods in your interface Usable
, Eclipse wont show any errors (compilation) Both of these work:
Usable usable = new ClassA();
Usable usable = new ClassB();
Upvotes: 2
Reputation: 121998
Every Child is Parent.
So it is. You may not seeing it directly but those methods getting inherited .
Upvotes: 1