JavaScript is disabled on your browser.

  * [ Overview ](../../overview-summary.html)
  * [ Package ](package-summary.html)
  * Class 
  * [ Use ](class-use/Observable.html)
  * [ Tree ](package-tree.html)
  * [ Deprecated ](../../deprecated-list.html)
  * [ Index ](../../index-files/index-1.html)
  * [ Help ](../../help-doc.html)

_**Java™ Platform  
Standard Ed. 7 ** _

  * [ Prev Class  ](../../java/util/Objects.html "class in java.util")
  * [ Next Class  ](../../java/util/Observer.html "interface in java.util")

  * [ Frames ](../../index.html?java/util/Observable.html)
  * [ No Frames ](Observable.html)

  * [ All Classes ](../../allclasses-noframe.html)

  * Summary: 
  * Nested | 
  * Field | 
  * Constr  | 
  * Method 

  * Detail: 
  * Field | 
  * Constr  | 
  * Method 

java.util

##  Class Observable

  * [ java.lang.Object ](../../java/lang/Object.html "class in java.lang")
  *     * java.util.Observable 

  * * * *

  

    
        public class Observable
    extends [Object](../../java/lang/Object.html "class in java.lang")

This class represents an observable object, or "data" in the model-view
paradigm. It can be subclassed to represent an object that the application
wants to have observed.

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 the ` Observable ` 's ` notifyObservers `
method causes all of its observers to be notified of the change by a call to
their ` update ` method.

The order in which notifications will be delivered is unspecified. The default
implementation provided in the Observable class will notify Observers in the
order in which they registered interest, but subclasses may change this order,
use no guaranteed order, deliver notifications on separate threads, or may
guarantee that their subclass follows this order, as they choose.

Note that this notification mechanism is has nothing to do with threads and is
completely separate from the ` wait ` and ` notify ` mechanism of class `
Object ` .

When an observable object is newly created, its set of observers is empty. Two
observers are considered the same if and only if the ` equals ` method returns
true for them.

Since:

     JDK1.0 
See Also:

     [ ` notifyObservers() ` ](../../java/util/Observable.html#notifyObservers\(\)) , [ ` notifyObservers(java.lang.Object) ` ](../../java/util/Observable.html#notifyObservers\(java.lang.Object\)) , [ ` Observer ` ](../../java/util/Observer.html "interface in java.util") , [ ` Observer.update(java.util.Observable, java.lang.Object) ` ](../../java/util/Observer.html#update\(java.util.Observable,%20java.lang.Object\))

  *     * ###  Constructor Summary 

Constructors  Constructor and Description  
---  
` **[ Observable ](../../java/util/Observable.html#Observable\(\)) ** () `
Construct an Observable with zero Observers.  
    * ###  Method Summary 

Methods  Modifier and Type  |  Method and Description   
---|---  
` void ` |  ` **[ addObserver ](../../java/util/Observable.html#addObserver\(java.util.Observer\)) ** ( [ Observer ](../../java/util/Observer.html "interface in java.util") o) ` Adds an observer to the set of observers for this object, provided that it is not the same as some observer already in the set.   
` protected void ` |  ` **[ clearChanged ](../../java/util/Observable.html#clearChanged\(\)) ** () ` Indicates that this object has no longer changed, or that it has already notified all of its observers of its most recent change, so that the ` hasChanged ` method will now return ` false ` .   
` int ` |  ` **[ countObservers ](../../java/util/Observable.html#countObservers\(\)) ** () ` Returns the number of observers of this ` Observable ` object.   
` void ` |  ` **[ deleteObserver ](../../java/util/Observable.html#deleteObserver\(java.util.Observer\)) ** ( [ Observer ](../../java/util/Observer.html "interface in java.util") o) ` Deletes an observ