U can search on the ranch for HELLOTHERE as this question has been discussed many times. I searched for HELLOTHERE and found that you are putting two posts for the same question. We'd appreciate if u can try to look around rather than floating two more copies of the same post... Thanks
what actually happens is that when u pass the arguments sb1 &sb2 to the method method1() "t.method1(sb1,sb2)" a copy of the reference is passed to the method and not the actual reference.actually in this line the references are copied and passed to the method.now inside the method what u are doing is tthat u are actually modifying the object via the reference so s1.append modifies the object and hence sb1 also changes and the changes are visible to the caller method (the main method in this case).however the variable sb2 is not modified in any such way so there is no effect on the object. please insert these two lines after "s2=s1;"(i.e after line 4) System.out.println("s1 is"+s1); System.out.println("s2 is"+s2); it will make things clear. consider the following examples: 1.
here on line line two the callers variable is copied and passed into bumper() and incremented by 15.since the original xx is untouched ,line 3 will show that xx is 12345.
here in the changer method you the object is modified via the reference as distinguished from modifying the method argument(the reference)so the changes will be visible to the caller method and System.out.println(tf.getLabel);will print "hi there" and not "hi".
[I added UBB CODE tags to your source code to make it more readable. Please try to use them in the future - Ajith] [This message has been edited by Ajith Kallambella (edited August 31, 2000).]