Java StringWriter append() Example

StringWriter class append() method example. This example shows you how to use append() method.


Syntax is : public StringWriter append(CharSequence csq)
This method appends the specified character sequence to this StringWriter. This method behaves in exactly the same way as the invocation out.write(csq.toString()).

Here is the code.
/**
 * @(#) Append1StringWriter.java
 * A class representing use of method append() of StringWriter class in 
 java.io Package.
 * @Version  28-May-2008
 @author   Rose India Team
 */
import java.io.*;
public class Append1StringWriter {
    public static void main(String[] args){
        // Create object of StringWriter class.
        StringWriter objStringWriter = new StringWriter();
        // append() method call.
        objStringWriter.append("Rose India");
        System.out.println("Character sequence is appended successfully!");
        System.out.print("String in string buffer is : " + objStringWriter);
    }
}

Output of the program.
Character sequence is appended successfully!
String in string buffer is : Rose India

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US