StringBuffer和StringBuilder的区别

来源:互联网 发布:ubuntu更改密码 编辑:程序博客网 时间:2024/05/10 19:53


StringBuffer : A modifiable sequence of characters for use in creating strings, where all accesses are synchronized. This class has mostly been replaced byStringBuilder because this synchronization is rarely useful. This class is mainly used to interact with legacy APIs that expose it.

StringBuffer的所有方法都是同步的,不过由于这个特性非常少用,StringBuffer已经被StringBuilder所替代。

0 0
原创粉丝点击