Unlike some other languages, Java does not allow you to choose between pass-by-value and pass-by-reference.
All arguments are passed by value.
A method call can pass two types of values
to a method
Objects themselves cannot be passed to methods
. When a method modifies a primitive-type parameter, changes to the parameter have no effect on the original argument value in the calling method.
This is also true for reference-type parameters. If you modify a reference-type parameter so that it refers to another object, only the parameter refers to the new object—the reference stored in the caller’s variable still refers to the original object.
References: Java™ How To Program (Early Objects), Tenth Edition