For the following code:
public class Test15{
public static void method(StringBuffer sb){
sb.append(" Added");
sb = new StringBuffer("Hai");
}
public static void main(
String a[]){
StringBuffer sb = new StringBuffer("String Buffer");
method(sb);
System.out.println(sb);
}
}
The output is String Buffer Added
Can someone please explain why?
Thanks,
Fes