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();}
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();}
Copyright © 2021 Jogjafile Inc.
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: