The Writer class provides different methods that are implemented by its subclasses. Here are some of the methods:
- write(char[] array) - writes the characters from the specified array to the output stream.
- write(String data) - writes the specified string to the writer.
- append(char c) - inserts the specified character to the current writer.
- flush() - forces to write all the data present in the writer to the corresponding destination.
- close() - closes the writer.
Here is how we can implement the Writer using the FileWriter class.