How is + implemented in Java?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/47605/java-string-concatenation">java String concatenation</a>  </p>
</blockquote>



<p>Sources tell us that <code>concat</code> is implemented as follows:</p>

<pre><code>   public String concat(String str) {
        int otherLen = str.length();
        if (otherLen == 0) {
            return this;
        }
        int len = value.length;
        char buf[] = Arrays.copyOf(value, len + otherLen);
        str.getChars(buf, len);
        return new String(buf, true);
    }
</code></pre>

<p>Does <code>+</code> implementation differ when it comes to Strings? How? Is there a performance difference between <code>+</code> and <code>concat</code>. When should one be chosen over another?</p>
