DEVFYI - Developer Resource - FYI

How are Observer and Observable used?

Java Interview Questions and Answers (part 1)


(Continued from previous question...)

22. How are Observer and Observable used?

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.

(Continued on next question...)

Other Interview Questions