• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Observing Java Objects

 
bhaswar goswami
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
When we try to change one Java objects that is being Observed by some
other java objcts(Observer ) then the following method is called

void update(Observable o, Object arg) - of the Observer objects

first agrument is the Observable Object that is changed , but i don't
know the purpose of the second argument .
I want o know when this second parameter is used and how ?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's an arbitrary object that you can pass to the observers. You decide yourself what you pass there - it can be any object you like. You can use it to give the observers some more info about what was changed in the observable. Just whatever is useful for what you are using the Observable / Observer class and interface for.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic