I have Base interface:
public interface Doable {
void doAction(String str);
}
I have extending interface:
public interface DoubleDoable extends Doable{
@Override
default void doAction(String str) {
doOnce();
doOnce();
}
void doOnce();
}
And I have an implementation:
public class Action implements DoubleDoable {
public void doOnce() {
System.out.println(123);
}
}
However, it is not compiled, as: Error:(10, 8) java: Action is not abstract and does not override abstract method doAction(java.lang.String) in Doable
Am I doing something wrong?
doas this is a reserved keyword in Java.doto something else you'll be fine.dofor the method name.