This only happens with objects, not primitives. You will need to create a new object that has the values of the old object.
One way to do this for strings is:
1
| String newString = new String( oldString ); |
Bad advice is often worse than no advice at all. Since strings are immutable, there's absolutely no point in your code, other than wasting cpu time and memory.
Zerolife: What you've described should be impossible with strings. Post actual code which illustrates the problem. I suspect you're confused between '==' (tests if two references are the same object) and '.equals()' (tests if two different objects represent the same value/state).