Possible Duplicate:
Method name collision in interface implementation – Java
What do we do if we need to implement two interfaces both of which contain a method with the same name and parameters, but different return types? For example:
interface A {
public int foo();
}
interface B {
public double foo();
}
class C implements A, B {
public int foo() {...} // compilation error
}
Is there an easy way to overcome this issue?
The simplest solution is to always return
doublein A as it can store every possibleintvalue.If you is not an option you need to use an alternative to inheritance.