Java CharArrayWriter(int initialSize) Constructor
Syntax
CharArrayWriter(int initialSize) constructor from CharArrayWriter has the following syntax.
public CharArrayWriter(int initialSize)
Example
In the following code shows how to use CharArrayWriter.CharArrayWriter(int initialSize) constructor.
//from w ww . j ava 2 s .c om
import java.io.CharArrayWriter;
public class Main {
public static void main(String[] args) throws Exception {
String str = "from java2s.com!";
CharArrayWriter chw = new CharArrayWriter(100);
chw.write(str);
System.out.println(chw.toString());
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »