class Test { public static void main(String[] args) { StringBuffer sb = new StringBuffer("jack"); sb.append(true); sb.append('a'); sb.append(97).append(34.0).append(new char[]{'A','B'}); // 链式编程 System.out.println( sb.toString() ); // 输出缓冲区的中文本数据 sb = new StringBuffer("jack"); sb.insert( 2, "java" ); System.out.println( sb.toString() ); } } A: jacktruea9734.0AB jjavaack B: jacktruea9734.0AB jajavack C: jacktrueaa34.0AB jajavack D: jacktruea9734AB jajavack
class Test { public static void main(String[] args) { StringBuffer sb = new StringBuffer("jack"); sb.append(true); sb.append('a'); sb.append(97).append(34.0).append(new char[]{'A','B'}); // 链式编程 System.out.println( sb.toString() ); // 输出缓冲区的中文本数据 sb = new StringBuffer("jack"); sb.insert( 2, "java" ); System.out.println( sb.toString() ); } } A: jacktruea9734.0AB jjavaack B: jacktruea9734.0AB jajavack C: jacktrueaa34.0AB jajavack D: jacktruea9734AB jajavack
1