Summary: 1. StringBuffer is a thread-safe variable String sequence. 2. Although String has a variety of String methods, if you frequently increase or decrease String sequences, we recommend that you use StringBuffer first. [Java] package com. cxy. e; public class E {public static void main (String [] args) {/** String + operations are actually created StringBuffer objects, then use the append method to change * so the efficiency of directly using StringBuffer for string change operations is higher than that of String * Another important operation of StringBuffer and StringBuffer will modify the current string.. **/StringBuffer sb = new StringBuffer (); sb. append ("java "). append ("api"); System. out. println (sb. toString (); System. out. println ("=================="); // insert sb. insert (5, "6.0"); System. out. println (sb. toString (); System. out. println ("=================="); // replace www.2cto.com sb. replace (5, 8, "7.0"); System. out. println (sb. toString (); System. out. println ("===================="); // Output System in reverse order. out. println (sb. reverse (); System. out. println ("===================="); // delete a location sb. reverse (); System. out. println (sb. delete (5, 9); System. out. println ("========================= ");}}