Name

Observer

Synopsis

This interface defines the update( ) method required for an object to observe subclasses of Observable. An Observer registers interest in an Observable object by calling the addObserver( ) method of Observable. Observer objects that have been registered in this way have their update( ) methods invoked by the Observable when that object has changed.

This interface is conceptually similar to, but less commonly used than, the EventListener interface and its various event-specific subinterfaces.

public interface Observer {
// Public Instance Methods
     void update(Observable o, Object arg);  
}

Passed To

Observable.{addObserver( ), deleteObserver( )}

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.