public class Copy3 { public static void main(String[] args) {
//构造实例化
StringBuffer strbu = new StringBuffer("hello world\t");
char[] a = {'l','o','y','o','u'};
//调用方法 System.out.println(1+"\t"+strbu.append(true)); //append(boolean b);
System.out.println(2+"\t"+strbu.append('a')); //append(char b);
System.out.println(3+"\t"+strbu.append(a)); //append(char[] b);
System.out.println(4+"\t"+strbu.capacity()); //capacity();
System.out.println(5+"\t"+strbu.charAt(10)); //charAt(int index);
System.out.println(6+"\t"+strbu.delete(3, 9)); //delete(int start, int end);
System.out.println(7+"\t"+strbu.insert(5, false)); //insert(int offset, boolean b);
System.out.println(8+"\t"+strbu.substring(7)); //substring(int start)
System.out.println(9+"\t"+strbu.reverse() ); //reverse() } }
运行结果