Forum

Number Of Page View:100,000+/Months
LOGIN |New User

Reply

How Observer and Observable are used? 

The JDK provides a reusable embodiment of the pattern in the form of the java.util.Observer interface and the java.util.Observable class. Objects that subclass the Observable class maintain a list of observers. When an Observable object is updated it invokes the update() method of each of its observers to notify the observers that it has changed state. The Observer interface is implemented by objects that observe Observable objects.  
In Observer Pattern, object maintains a list of its dependents and notifies them automatically of any state changes, usually by calling one of their methods. It is mainly used to implement distributed event handling systems.
Posted By: Name:Rajesh Kr URL: How Observer and Observable are used?