public class A { private D d; private C c; public A (C c) { this.c = c; } public void setD (D d) { this.d = d; } ... public interface B { public void aa(); public void bb(); public void cc(); } }
public class C { private A a = null; ... protected void init() { a = new A(this); a.setD(new D()); } protected class D implements A.B { public void aa() { ... } public void bb() { ... } public void cc() { ... } } }
Java接口回调
时间: 2024-10-12 15:21:29