This code works perfectly. The method test() works for both interfaces. What is exactly going on under the hood? And how is this feature useful in practical scenario?
interface A
{
void test();
}
interface B
{
void test();
}
class C implements A, B
{
public void test()
{
System.out.println("abc");
}
}
A a = new C();
a.test();
B b = new C();
b.test();
See Question&Answers more detail:os