提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
StringBuilder追加方法。
public class Main { public static void main(String[] args) /* *来 自 nowjava - 时 代 Java */ { Object objectRef = "hello"; String string = "goodbye"; char[] charArray = {'a', 'b', 'c', 'd', 'e', 'f'}; boolean booleanValue = true; char characterValue = 'Z'; int integerValue = 7; long longValue = 10000000000L; float floatValue = 2.5f; double doubleValue = 33.333;//来自 n o w j a v a . c o m StringBuilder lastBuffer = new StringBuilder("last buffer"); StringBuilder buffer = new StringBuilder(); buffer.append(objectRef) .append("%n") .append(string) .append("%n") .append(charArray) .append("%n") .append(charArray, 0, 3) .append("%n") .append(booleanValue) .append("%n") .append(characterValue) .append("%n") .append(integerValue) .append("%n") .append(longValue) .append(