Even objects are passed by value. In this case, the reference (not the whole stack object) s1 and s2 are copied and passed to the method processStacks. Inside the method, if you change the reference (x2=x1) then the change is not reported outside the method because the reference were copied... That is, outside the method, s1 and s2 will still refer to their initial stack.
(Imagine the nightmare it would be to find a bug if reference passing was allowed in
Java. I find it much more better that way, but it's a matter of personal taste, of course.)
HIH