public class test {
public static void main(String[] args) {
// TODO Auto-generated method stub
StringBuffer a = new StringBuffer("A");
StringBuffer b = new StringBuffer("B");
operator(a, b);
System.out.println(a + "," + b);
}
public static void operator(StringBuffer a, StringBuffer b) {
a.append(b);
b = a;
}
Why is b still print out B? I did b = a in the operator, shouldn't it print out AB as well?