Java IO Tutorial - Java CharArrayWriter.write(int c)








Syntax

CharArrayWriter.write(int c) has the following syntax.

public void write(int c)

Example

In the following code shows how to use CharArrayWriter.write(int c) method.

//  w  w w .  j  a  v  a2s .co m
import java.io.CharArrayWriter;

public class Main {
  public static void main(String[] args) {
    CharArrayWriter chw = new CharArrayWriter();

    for (int i = 65; i < 70; i++) {
      chw.write(i);

    }
    String str = chw.toString();
    System.out.println(str);
  }
}

The code above generates the following result.