1
JavaIntermediate#strings
String is immutable. StringBuilder is mutable and not thread-safe (fast). StringBuffer is mutable and synchronized (thread-safe, slower). Use StringBuilder for single-threaded concatenation in loops.
StringBuilder sb = new StringBuilder(); for (int i = 0; i < 5; i++) sb.append(i); System.out.println(sb.toString()); // "01234"