File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Object communication in java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
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: 191
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.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12759
    
    5
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

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://aspose.com/file-tools
 
subject: Object communication in java?
 
Similar Threads
access Singleton class method thru jsp useBean
string in to base64encoder
What does a "one to many" relationship mean
Not using Maiin()
Java Class