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