Public Static void Testappend () { new StringBuffer ("This is a stringbuffer!" ); Sb.append (1.23f); System.out.println (Sb.tostring ());
The output is a stringbuffer!1.23f
Introduction to the Append method of the StringBuffer object, in the 4th Chapter array and string lectures in the Java 2 Primer (JDK 5) (English name: Beginning java 2,jdk 5 Edition), Ivor Horton Section 4.4, adding additional content to the StringBuffer object, describes the ability to append substrings using the Append () method. The original text provides examples as follows:
StringBuffer buf=New stringbuffer ("hard"); = "Waxworks"; Buf.append (astring,3,4);
This operation appends the astring four-character substring starting at index position 3 to the StringBuffer object buf. The output is hard work and then
the BUF object will contain the string "hard work".
The use of the StringBuffer class append method in Java