Hi sandhya,
public void amethod()
{
int i = 99;
ValHold v = new ValHold();
v.i=30;
another(v,i);
System.out.println(v.i);
}//End of amethod
public void another(ValHold v, int i)
{
i=0;
v.i = 20;
ValHold vh = new ValHold();
v = vh;
System.out.println(v.i+ " "+i);
}
In another(), the object ValHold is ref by a local ref.variable v, and that local ref.varible is now assigned to another object in another().
But, the ref.variable present in amethod() is still pointing the same object.So, u got the result as 10 0 20.
I think u r confused with 2 ref.variable with same name (v).
[This message has been edited by senthil kumaar (edited May 02, 2001).]