Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

core java

 
Korada Rajshekar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If we have a instance variable like int i=10 and for that class we have two objects if we change the value of i using first object then how can it notify to second object that the value of 'i' is changed....Without using Threads concept....just using normal objects
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
introduce a method which takes the same object as an argument. now test the argument object's instance field and perform a operation..something like below:
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please, UseAMeaningfulSubjectLine .
 
Rob Spoor
Sheriff
Pie
Posts: 20552
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd probably add support for PropertyChangeListener, through PropertyChangeSupport:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic