String StringBuffer StringBuilder

String is fixed ,so object when created ,it cannot be modified any more. it's ineffective. in-effulent;

when you use "+" to combine two String, via anti-compile,you can find String transformed into StringBuilder.

so you can use StringBuilder and StringBuffer class to connect two string.

 

 

StringBuilder and StringBuffer  API is same. append(), toString().

 

what difference between StringBuilder and StringBuffer?

StringBuffer is multi-thread safe,it will handle synchronized issue.

StringBuilder is one-thread usage.

posted @ 2022-11-15 23:53  MikeLi  阅读(11)  评论(0编辑  收藏  举报