• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Use Of Observable class and Observer Interface

 
Sandeep Jain
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just wanted to know how is observable class useful ie the functionality point of view. Can anybody send some examples using the observable class and Observer interface.
------------------
Sandeep Jain
 
Tanveer Rameez
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
Observable is a class that can be observed for any change in its state by the Observer class. Once an observer class registers itself as the observer of the observable class, it does not have to continuosly observe the observable class explicitly for any change. The Observable class then itself informs all such observer class about any change in its state. For that we have to overide the setChange(), notifyObservers(),update() and some other methods.
See the examples in Java 2 Complete Reference. Another book contains a good example-Servlet Programming-O'reilly in the applet-servlet communicaton chapter
hope that helps you
bye
Tanveer
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic