First thing to remember is that ,stringBuffer's methods dont create a new object(where as
string create a new object when used with "+" operator.).
before the call to the mybuff(),
s1--> hello
s2--> doing
after the call,in the method,
s1 and(s1) --> hello // (s1) is local variable
s2 and (s2)--> doing // (s2) is local varaiable
After append
s1 and(s1) --> hello how are you
s2 and (s2)--> doing
After s1=s2
s1 --> hello how are you
s2 and (s1),(s2)--> doing
When method returns,
s1 --> hello how are you
s2 --> doing
Hope you got it.
And s1 of line 3 is local variable
s1 at line 4 is not same as line 3 s1
[ December 02, 2008: Message edited by: James Tharakan ]