Question

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

Was it helpful?

Solution

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();

OTHER TIPS

Every Child is Parent.

So it is. You may not seeing it directly but those methods getting inherited .

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top