What should be the output of the foll piece of code?
public class test
{
public static void main(String args[])
{
StringBuffer a = new StringBuffer("Hello");
StringBuffer b = new StringBuffer("Hello");
testtestObj = new test();
testObj.convert(a,b);
System.out.println(a);
System.out.println(b);
}
public void convert(StringBuffer x,StringBuffer y)
{
x.append("There");
y = x;
}
}
a)Hello ,Hello
b)Hello there,Hello there
c)Hello there,Hello
d)Compiler Error
Me thinks it should be b,but when I executed the code,it displayed c.
Any idea why???
Gayatri