title: Why am I getting different outputs with .concat() and += with Java Strings?
body: <p>Studying for OCAJ7</p>
  
  <p>I know String objects are immutable. I know using methods like <code>.concat()</code> on a String object will just create a new String object with the same reference name. I'm having a hard time, however, with wrapping my head around the following:</p>
  
  <pre><code>String str1 = "str1";
  String str2 = "str2";
  System.out.println( str1.concat(str2) );
  System.out.println(str1);
  
  // ouputs
  // str1str2
  // str1
  
  String str3 = "fish";
  str3 += "toad";
  System.out.println(str3);
  
  // outputs
  // fishtoad
  </code></pre>
  
  <p>If strings are immutable, why does using <code>+=</code> to concatenate affect the original String object, but <code>.concat()</code> does not? If I only want a String to concatenate with using <code>+=</code>, is using <code>String</code> better than using <code>StringBuilder</code>, or vice versa? </p>