There are two classes: A and B. The class B need to inform a class A when some important event has happened. What Java techniqu

Q

There are two classes: A and B. The class B need to inform a class A when some important event has happened. What Java technique would you use to implement it?

✍: Guest

A

If these classes are threads I'd consider notify() or notifyAll(). For regular classes you can use the Observer interface.

2013-04-19, 2072👍, 0💬