Yes, you're passing values.
BUT: Your values are objects with attributes and methods. In your operate function, you're using these methods to change the internal attributes of your values.
Here's what's happening:
static void operate (StringBuffer x, StringBuffer y)
{
// x and y are passed by value. but they have internal values themselves.
// here, you're changing x's internal value. You're not changing x itself, only its internal value!
x.append(y);
// here, you're creating a new variable in the local scope of this function.
// this does not change the variable you passed into this function, because
// it is outside of this function's scope.
// IF you would be passing by reference (which you are not!), this would
// change the outer y
y = x;
}
public static void main (String [] args)
{
StringBuffer a = new StringBuffer ("A");
// a = "A"
StringBuffer b = new StringBuffer ("B");
// b = "B"
operate (a,b);
// a = "AB", because you changed a's internal value
// b = "B", because you didn't change its internal value
// y_inside_the_function = "AB", but y only exists inside the function's scope
System.out.println(a + "," +b);
// "AB,B"
}
There are some good explanations in this StackOverflow post: methods - Is Java "pass-by-reference" or "pass-by-value"? - Stack Overflow
Have a great day!
Johannes