Difference between String and the other two classes is that String is immutable and the other two are mutable classes.
But why we have two classes for same purpose?
Reason is that StringBuffer
is Thread safe and StringBuilder
is not.
StringBuilder
is a new class on StringBuffer Api
and it was introduced in JDK5
and is always recommended if you are working in a Single threaded environment as it is much Faster
For complete Details you can read http://www.codingeek.com/java/stringbuilder-and-stringbuffer-a-way-to-create-mutable-strings-in-java/