String is immutable, while StringBuilder and StringBuffer are mutable buffers you change in place. The two buffers differ in thread safety. StringBuffer synchronizes its methods, and StringBuilder does not.
String
StringBuilder
StringBuffer
Mutable
No
Yes
Yes
Thread-safe
Yes, because it never changes
No
Yes, through synchronized methods
Cost of building text
A new object for every change
Lowest
Higher, it pays for locking
Every change to a String creates a new object, so += inside a loop copies the text again and again. A builder appends into one growing buffer instead.
StringBuilder is the default choice for building text in one thread. It has the same API as StringBuffer without the synchronization overhead. The Java documentation recommends it wherever possible, because it is faster under most implementations. StringBuffer only makes sense when several threads really append to the same buffer.