public static void appendStr(Stringbuffer sb) {
sb.append("hohohoho");
}
public static void main(String args) {
Stringbuffer sbf = new Stringbuffer("xixixi");
appendStr(sbf);
system.out.println(sbf);
}
结果是xixixihohohoho
其实传的就是地址,但java的引用传递只限于对象,基本类型和String类都是字面值传递