File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Object communication in java?

 
Ashish K Sharma
Ranch Hand
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to Notify an class A whenever something happenes to another class B, i mean any method called, any variable updated?
How can i achieve this in java?

Ashish
 
Awais Bajwa
Ranch Hand
Posts: 191
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a referece of Clas A to get notified in B. Read Observer Design Pattern.
Awias Bajwa
 
Peter Chase
Ranch Hand
Posts: 1970
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you change class B?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13045
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to Notify an class A whenever something happenes to another class B,


Keep in mind that you are really talking about an instance of class A and an instance of class B, NOT the Class object.

Bill
 
Ashish K Sharma
Ranch Hand
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your inputs.
Yes it's abour object instances for sure.
I believe i need to gain more knowledge on design patterns first.
Thanks again
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic