ITeye博客

Criteria to choose among String, StringBuffer and StringBuilder

skyyfd · 2010-07-02 15:02 · technology · 编程语言 · Markdown

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

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。