String values can be changed just as any other variable can be changed. The only way a String value can not be changed is if it is "final static" (or basically a constant).
This exercise got me thinking...and I was a bit confused because of what the following question from the
Java Rule Round-up game tells me.
Java Rule Round-up - question #204
Question: When you pass an object reference as an argument to a method call, what gets passed?
Answer: A copy of the reference. You always get a copy of whatever is in the variable -- either a primitive or a reference. So for objects, you get a copy of the reference.
If what is being passed into this method is indeed copies of object references (which I think of as being memory locations), and these references are pointing to the objects, and not the actual value of the objects; wouldn't this mean that the since it's the same object, aren't the references the same (i.e. reference 1 evaluates to memory location 25, and reference 2 also evaluates to memory location 25, because both references point to object s)? And if the reference is the same, than there can only be one value stored in this reference, which would be "gone"?
If you can follow what I'm trying to say (it's late, and I might not be at the top of my game), please shead some light on this for me!
Thanks,
--Chris