It is basic problem. I have class A which gives some task to class B. When class B finish the tast it must notify class A. I want register A class method as callback in class B.
I really want do it in this way, not by observer pattern with interface Observable.
public class A
{
public void A()
{
B b = new B()
b.registerCallback(callback);
}
private void callback()
{
}
}
public class B
{
private ???? callbackoNotify;
public class registerCallback(??? callback)
{
callbackoNotify = callback;
}
public void notify()
{
callback();
}
}