"Rohit Gupta" wrote...
> I have two classes A and B, A creates an object of B b_ob.
> A has a private variable x. Now I need to change the value
> of x from the object b_ob.
>
> I hope the problem is clear,
Only partially...
You ask "how" to do a specific thing technically, without telling us *why*
you want to do it. Bi-directional coupling is mostly a bad idea...
As an aside, newbies are usually better off in the group
comp.lang.java.help...
> can someone suggest a way of doing so!!
E.g.:
1. Let the instance of B get a reference
to the instance of A
This can be accomplished by e.g. providing the reference at instantiation of
the B object, or by providing it at a later stage, depending on how the
sequences of messages will go further on in the application.
2. Let there be a mutator (e.g. a public set-method)
for 'x' in the A class.
/// Bjorn A
Inviato da X-Privat.Org - Registrazione gratuita
http://www.x-privat.org/join.php