StringBuffer c=new StringBuffer("def");
and
"StringBuffer c" in "static void operate(StringBuffer b, StringBuffer c) " are not same.
When you call "c=b;", value of b is assigned to the temporary varibale, not to the c created in main().
So, if you print c in operate, result will be "abcdef", in main as it is not modified (only its copy is modified) it would print "def"..
Good to spend some time understanding differences between String & StringBuffer and concepts of pass by value & pass by reference..