At the Colorado Software Summit, it was mentioned to use StringBuffers to concatenate strings instead of simply using the
String class (I understand that Strings are first converted to String buffers anyway when concatenation occurs).
At what point does it start paying off to do this? Concatenating 2 strings? 3 strings? 4 strings? etc...
Also, if you have a long string that uses concatenation (simply to improve the readability of the code), will the compiler "optimize" it for you, or should you still use String buffers. For example:
String query = "select first, last, address, telephone, email"
+ " from employee"
+ " where country = 'US'"
+ " order by last, first";
Note: None of the strings parts are dynamic, all of them are static.
David Lu