Tuesday 11 November 2014

A Class can't implement multiple Interfaces

Every one knows that a java class can implement multiple interfaces, but there is a case where it is not possible to implement multiple interfaces. For example take two interfaces TestA and TestB having same method but different return types like,

interface TestA{

void m1();

}


interface TestB{

int m1();

}

Then it is not possible to create a class implementing these two interfaces, because a class can't allow two methods with same signature but different return types.

Thanks..

No comments:

Post a Comment