Hi vishwa!
To pass by refence you can "wrap" the variable using an array (I can't remember the exact wording, but wrap is the term I remember). Take a look at the program that I built and see if you can understand it. It compiles and runs fine.
-- the code for the program is below --
class
Test {
String str = new String ("this is the original value in the string");
public static void doTest (Test [] arr)
{
arr[0].str = "this is the new value";
}
public static void main(String [] args)
{
Test t = new Test ();
// display t.str's value
System.out.println(t.str);
// assign the address of t to a new variable (an array)
Test [] w = new Test [1];
w[0] = t;
// pass the reference
doTest (w);
// and now display t. It should display the new string
System.out.println(t.str);
}
}
---------- end prg code ---
I hope this helps.