what are Observer and Obeservable in Java?
Printable View
what are Observer and Obeservable in Java?
Objects that subclass the Observable class maintain al ist 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.
Thank's Kiranmaye.
The observable class is used to create subclasses that other parts of your program can observe.
When an object of such a subclass undergoes a change, observing classes are notified.
obeserving classes must implement the observer interface, which defines update method.
OBSERVER : To observe an observable object you must implement the observer interface. This interface defines only one method called update().