public abstract class ClassA implements ClassB{
}
public class ClassC extends ClassA implements ClassB{
}
Since class "ClassC" is extending class "ClassA", does "ClassC" still has to implement "ClassB"? Or "ClassB" is automatically implemented for class "ClassC"?
Assuming ClassA
is not abstract
and fully implements ClassB
, then ClassC
inherits ClassA
's implementation and does not need to re-implement anything from ClassB
unless it wants to override the behavior.
It also does not need to specify implements ClassB
. The following example is valid:
public static interface I { }
public static class A implements I { }
public static class B extends A { }
public static void main(String[] args) {
I b = new B();
}