public class abc{
public void method1(StringBuffer s1, StringBuffer s2){
s1.append("there");
s2 = s1;
}
public static void main(
String args[]){
StringBuffer sb1 = new StringBuffer("Hello");
StringBuffer sb2 = new StringBuffer("Hello");
abc a = new abc();
a.method1(sb1,sb2);
System.out.println(" sb1 is " + sb1 + "and sb2 is " + sb2);
}
}
// The output of this is sb1 is Hellothere and sb2 is Hello.
can anybody explain me how this output has come.