How are Observer and Observable used

Objects that subclass the Observable class maintain a list of observers. When anObservable object is updated it invokes the update() method of each of its observers tonotify the observers that it has changed state. The Observer interface is implemented byobjects that observe Observable objects.

Showing Answers 1 - 9 of 9 Answers

Vipul

  • Jul 17th, 2007
 

Observer observe only those class which are Observable.

  Was this answer useful?  Yes

observer pattern (a subset of the publish/subscribe pattern) is a software design pattern in which an object, called the subject, maintains a list of its dependants, called observers, 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

  Was this answer useful?  Yes

An observable object can have one or more observers. An observer may be any object that implements interface Observer. After an observable instance changes, an application calling theObservable's notifyObservers method causes all of its observers to be notified of the change by a call to their update method.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions