Java: StringBuffer & Concatenation

后端 未结 6 2089
梦如初夏
梦如初夏 2021-01-05 01:59

I\'m using StringBuffer in Java to concat strings together, like so:

StringBuffer str = new StringBuffer();

str.append(\"string value\");

6条回答
  •  南笙
    南笙 (楼主)
    2021-01-05 02:39

    You should be using StringBuilder.

    Where possible, it is recommended that this class be used in preference to StringBuffer as it will be faster under most implementations.

提交回复
热议问题