Let's say I have two interfaces InterfaceA and InterfaceB with the same method signature. InterfaceA:
public interface InterfaceA {
void printInterfaceName();
}
And InterfaceB:
public interface InterfaceB {
void printInterfaceName();
}
And I have a Printing class that is implementing both the interface Printing class:
public class Printing implements InterfaceA, InterfaceB {
// want to override the printInterfaceName() method such way
// so that it will give an output which given in main method comment
}
And I have a Main class with a main method on it
public class Main {
public static void main(String[] args) {
InterfaceA a = new Printing();
InterfaceB b = new Printing();
a.printInterfaceName(); // this is should print `INTERFACE-A`
b.printInterfaceName(); // and this is should print `INTERFACE-B`
}
}