If two interfaces require to implement the method with the same name, then the method() is called twice. I need 2 methods implemented for 2 different interfaces, how can I implement both of them to do different things?
public class MainClass implements BarObj.BarInt, FooObj.FooInt{
MainClass(){
}
void trigger()
{
new BarObj(this);
new FooObj(this);
}
@Override
public void method() {
System.out.println("I DONT KNOW WHICH METHOD");
}
public static void main(String[] args) {
new MainClass().trigger();
}
}
public class BarObj {
interface BarInt
{
void method();
}
public BarObj(BarInt _barInt)
{
_barInt.method();
}
}
public class FooObj {
interface FooInt
{
public void method();
}
public FooObj(FooInt _fooInt)
{
_fooInt.method();
}
}