With Java, all paramters are passed by value. That means a function gets a copy of the original reference when passing objects like strings. Because strings are
Immutable Objects (The Java™ Tutorials > Essential Classes > Concurrency)[
^], a new string is created and assigned to the copy of the reference while the original is left unchanged.
But when using an array, the copy of the reference is unchanged (still the same value as the original) so that array items can be changed.
See also the SO thread
c - Passing a String by Reference in Java? - Stack Overflow[
^] which also provides solutions to modify a string passed as function parameter.