String StringBuffer StringBuild的区别
String类型不可改变
StringBuffer 可变字符串 线程 安全 效率低
StringBuilder 可变字符序列 线程不安全
public class Test1{
public static void main(String[] args) throws Exception {
StringBuffer a=new StringBuffer("abcd");
Test1 test1 = new Test1();
test1.change(a);
System.out.println(a);
}
public static StringBuffer change(StringBuffer a) {
a.append("ED");
return a;
}
}