How are Observer and Observable used?

Answer Posted / supriya

Subclass of Observable class maintain a list of observers.
Whenever an Observable object is updated, it invokes the
update() method of each of its observers to notify the
observers that it has a changed state.
An observer is any object that implements the interface
Observer.

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is Java a dying language?

797


Can you write a java class that could be used both as an applet as well as an application?

697


Explain enumeration in java?

769


How do you control extraneous variables?

680


What is a qualifier in a sentence?

747


Why do we need autoboxing in java?

755


If we don’t want some of the fields not to serialize how to do that?

776


How does list work in java?

693


What is the function of compareto in java?

796


Which is bigger float or double?

749


What is the difference between length and size in java?

706


How do I type unicode?

732


Explain illegalmonitorstateexception and when it will be thrown?

828


You're given a Boolean 2D matrix, can you find the number of islands?

834


Does java allow overriding static methods ?

834