Originally posted by Ulf Dittmer:
If you want "s" to be immutable, declare it "final" (which you can't do in this case because s is a local variable, but which would be possible if s was an instance variable).
Local variables can be "final", can't they? We don't do it often in
Java, but it's legal, I think.