String s = "foo";
s = "bar";
The String itself is a static object, but the variable can be reassigned to a new String.
Or, methods on the String don’t change the String, they return a new String – which you assign to the reference.
s = s.replace('r', 'z'); // bar -> baz