Java CharArrayWriter append() Example
CharArrayWriter class append() method example. This example shows you how to use append() method.
Syntax is : public CharArrayWriter append(CharSequence csq)
This method appends the specified character sequence to this writer. Depending on the specification of toString for the character sequence csq, the entire sequence may not be appended. For instance, invoking the toString method of a character buffer will return a subsequence whose content depends upon the buffer's position and limit.
Here is the code.
/**
* @(#) Append1CharArrayWriter.java
* A class representing use of method append() of CharArrayWriter() class in
java.io Package.
* @Version 31-May-2008
* @author Rose India Team
*/
import java.io.*;
public class Append1CharArrayWriter {
public static void main(String[] args){
// Create object of CharArrayWriter class.
CharArrayWriter objCharArrWriter = new CharArrayWriter();
// append() method call.
objCharArrWriter.append("MAHENDRA");
System.out.println("character sequence are appended successfully!");
System.out.print("Elements in char buffer is : " + objCharArrWriter);
}
} |
Output of the program.
characters sequence are appended successfully!
Elements in char buffer is : MAHENDRA |
|