Skip to content
Advertisement

Tag: default-method

Selecting default implementation from indirectly inherited Interface not working

I have 4 Classes that look like this: Why can’t I access the default implementation coming from extending Bar? Answer BarImpl can not invoke Foo’s default method explicitly, as BarImpl is not directly implementing Foo. It’s extending Bar which directly implements Foo, hence, it’s Bar’s decision to override Foo’s default method or not. BarImpl can only invoke Bar’s isEmpty() method

Advertisement