What is the true story about how parameters are passed in Java? Is is by value or by reference?
. All parameters (values of primitive types, & values that are references to objects) are passed by value [JLS sect 8.4.1]. However this does not tell the whole story, as objects are always manipulated through reference variables in Java. Thus one can equally say that Objects are passed by reference (and the reference variable is passed by value). This is a consequence of the fact that variables do not take on the values of “objects” but values of “references to objects” as described in the previous answer. Bottom line: primitive type arguments (int, char, etc) _do not_ change when the corresponding parameter is changed. The fields of object type arguments _do_ change when the corresponding parameter fields are changed.