How should I copy Strings in Java?
<pre><code>    String s = "hello";
    String backup_of_s = s;
    s = "bye";
</code></pre>

<p>At this point, the backup variable still contains the original value "hello" (this is because of String's immutability right?).</p>

<p>But is it really <strong>safe</strong> to copy Strings with this method (which is of course not safe to copy regular mutable objects), or is better to write this? :</p>

<pre><code>    String s = "hello";
    String backup_of_s = new String(s);
    s = "bye";
</code></pre>

<p>In other words, what's the difference (if any) between these two snippets?</p>
