...
Code Block |
---|
public interface CallBack { void callMethod(); } class CallBackImpl implements CallBack { public void callMethod() { System.out.println("CallBack invoked"); } } class Client {CallBackAction CallBack callback; public void registerCallBackCallBackAction(CallBack callback) { this.callback = callback; } public void doSomethingperform() { callback.callMethod(); } } class Client { public static void main(String[] args) { ClientCallBackAction clientaction = new Client(); client.registerCallBack(CallBackAction(new CallBackImpl()); // ... client.doSomethingperform(); // Prints "CallBack invoked" } } |
...