A class implements two interfaces. Which interface does a method belong to?

interface, java

Solution

I think we can say that A.m1 implements both B.m1 and C.m1. Because both

B b = new A();
b.m1();

and

C c = new A();
c.m1();

will work

Problem

There are two interfaces `B` and `C` each having the same method `public m1()` ``` class A implements B and C ``` If class `A` has to implement method `m1()`, the implemented method would be of which interface?

Original source

Related problems