Why this code is not giving the output as expected : <p>I was expecting the output as AB , ABCD but the output is ABCD , B. How's that possible?</p>

<pre><code>
    public class Test {
           public static void main(String[] args) {
                 StringBuffer a = new StringBuffer("A");
                 StringBuffer b = new StringBuffer("B");
                 operate(a, b);
                 System.out.println(a + " " + " , " + " " + b);

           }

           static void operate(StringBuffer x, StringBuffer y) {
                 x.append(y);
                 y = x.append("C");
                 y.append("D");
           }
    }

</code></pre>
