StringBuffer is a variable string object, we can use:
String name = "zs";
StringBuffer sb = new StringBuffer (name); // string to StringBuffer object
String newStr = sb.toString (); // StringBuffer objects into String.
commonly used ways:
StringBuffer commonly used method is: append ().
比如: sb.append("asf").append("234");
StringBuffer flashback can sort strings, reverse () methods.
StringBuilder and StringBuffer difference:
1. Their function is basically the same, the only difference is that StringBuilder is not thread-safe. StringBuffer thread safe.