1) constant expressions (JLS 15.28) like "this string" + " should" + " be" + " joined" do not need a StringBuilder because it is evaluated at compile time into a single line "this string should be joined"
2) StringBuilder is automatically applied to the mutable expression compiler. That is, "string" + var equivalent to new StringBuilder().append("string").append(var).toString();
We only need to explicitly use StringBuilder, where the string is built dynamically, for example here
StringBuilder s = new StringBuilder(); for (String e : arr) { s.append(e); }
source share