Java IO Tutorial - Java CharArrayWriter.append(char c)








Syntax

CharArrayWriter.append(char c) has the following syntax.

public CharArrayWriter append(char c)

Example

In the following code shows how to use CharArrayWriter.append(char c) method.

/* w ww. jav a 2 s .  c  o m*/

import java.io.CharArrayWriter;

public class Main {
  public static void main(String[] args) {

    char[] ch = { 'A', 'B', 'C', 'D', 'E', 'F' };

    CharArrayWriter chw = new CharArrayWriter();

    for (char c : ch) {
      chw.append(c);
    }
        System.out.println(chw.toString());
  }
}

The code above generates the following result.