本文通过StringBuffer 源码,来理解append(),方法。
============================================================================
str.append(""); 是用来拼接字符窜,一般人我不告诉他。
一、直接上示例:
public class TestString {
public static void main(String[] args) {
StringBuffer buffer = new StringBuffer();
buffer.append("hello ");
buffer.append("world!");
System.out.println(buffer); //结果 hello world!
}
}