What are the operating string java class? What is the difference between them?

Java, the commonly used type of string operations are String, StringBuffer, StringBuilder

  • String: final modification of the method of the String class are return new String. That is, any changes to the String object does not affect the original object, generate a new object will be to modify the operation of the string.
  • StringBuffer: a method of operating a string are added synchronized, thread-safe.
  • StringBuilder: not thread-safe, need to be modified to manipulate strings in vivo, may be new StringBuilder object, call the object StringBuilder append (), replace (), delete () methods modify the string.

 


 

All resources resources are summarized in the public No.

Guess you like

Origin www.cnblogs.com/ConstXiong/p/11808178.html