接口A:
public interface A{
public void callA();
}
类B:
public class B{
private A a;
public void do(A a){
this.a=a;
}
public void callB(){
a.callA();
}
}
类C:
public class C{
B b=new B();
b.do(new A(){
public void callA(){
//do something
}
});
b.callB();
}