0

A class can implement multiple interface in Java, if some of the interfaces contain methods with same signature. Since a class can implement a method with a given signature only once. what problems can this situation lead to ?

 interface a {
    public show();
}
interface b {
    public show();
}

class name implements a,b {
    private int var = 10;
    public show() {
    System.out.print(var);
 }
}
saurav1405
  • 399
  • 3
  • 9

1 Answers1

2

No problems. Single implementation works for the both interfaces in derived class.

But if you want different implementations for each interfaces, you need to change the signature.

Suresh Atta
  • 120,458
  • 37
  • 198
  • 307