What is the reason behind overriding a method/methods of an interface in the sub interface?
for example
interface I{ public void method();} interface I2 extends I{@Override public void method();}
You may need to change the return type of your method to a sub-type of the original return type. eg:
interface I { public Object method(); } interface I2 extends I { @Override public Integer method(); }
Or you can add default implementation to the method which is introduced in Java 8. eg:
default
interface I { public void method(); } interface I2 extends I { @Override default public void method() { System.out.println("do something"); } }
You may need to change the return type of your method to a sub-type of the original return type. eg:
Or you can add
default
implementation to the method which is introduced in Java 8. eg: