jQuery in Action, 2nd edition
The moose likes Java in General and the fly likes Object communication in java? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Object communication in java?" Watch "Object communication in java?" New topic
Author

Object communication in java?

Ashish K Sharma
Ranch Hand

Joined: Aug 22, 2006
Posts: 31
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

Joined: Jan 16, 2001
Posts: 190
Use a referece of Clas A to get notified in B. Read Observer Design Pattern.
Awias Bajwa
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Can you change class B?


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.<br /> <br />#:^P
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12265
    
    1
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


Java Resources at www.wbrogden.com
Ashish K Sharma
Ranch Hand

Joined: Aug 22, 2006
Posts: 31
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
 
I agree. Here's the link: http://jrebel.com/download
 
subject: Object communication in java?
 
Similar Threads
access Singleton class method thru jsp useBean
What does a "one to many" relationship mean
Java Class
string in to base64encoder
Not using Maiin()