public class Demo5_StringBuffer {
public static void main(String[] args) {
StringBuffer sb = new StringBuffer("niaho"); //String 转换为StringBuffer通过构造方法
System.out.println(sb);
StringBuffer sb1 = new StringBuffer();
System.out.println(sb1.append("nihaoma")); //通过StringBuffer的append方法将字符串转换为StringBuffer
}
}
|
|