Java Writer.append(char c)
Syntax
Writer.append(char c) has the following syntax.
public Writer append(char c) throws IOException
Example
In the following code shows how to use Writer.append(char c) method.
/*ww w .j ava 2 s.c o m*/
import java.io.*;
public class Main {
public static void main(String[] args) {
char c = 'A';
Writer writer = new PrintWriter(System.out);
try {
// append a char
writer.append('c');
// append a new char
writer.append(c);
// flush the writer to see the result
writer.flush();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »