`

Criteria to choose among String, StringBuffer and StringBuilder

阅读更多
String is immutable ,and StringBuilder ,StringBuffer both of them are mutable,they can change their value
criteria to choose among them
when your text value are not chageable ,you can use the String ,beacuse a String Object is immutable.
when your text value are changeable and unsynchronized ,you can use the StringBuilder ,bease StringBuilder is unsynchronized.StringBuilder is more efficient than the StringBuffer,it will be accessed only with a thread
when your text value are changeable and synchronized ,you can use the StringBuffer
the main methods of the them are append .it will be accessed with mutliple threads
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics