StringBuilder is the most efficient class. It does not have the
overhead of Synchronization. StringBuffer is a Synchronized class.
It has better performance than String but it is slower than
StringBuilder. String is the slowest for any String processing
operations, since it is leads to creation of new String literal with
each modification.
So the decreasing order of efficiency is: StringBuilder, StringBuffer,
String
https://www.geeksforgeeks.org/string-vs-stringbuilder-vs-stringbuffer-in-java/