can a class implement two interfaces with the same method signature?

Yes, a class can implement two two interfaces with the same method signature but that method should be implemented only once in the class. Example

interface Test1 {
    void show();
}
interface Test2 {
    void show();
}
public class Main 
{ 
    void show(){
        System.out.println("Implemented method.");
    }
 
    public static void main(String[] args) 
    { 
        Main object = new Main();
        object.show();
    } 
}

Output

Implemented method.
Please follow and like us:
Content Protection by DMCA.com