The Writer class of the java.io package is an abstract superclass that represents a stream of characters. Since Writer is an abstract class, it is not useful by itself. However, its subclasses can be used to write data. In order to use the functionality of the Writer, we can use its subclasses. Some of them are:
In order to create a Writer, we must import the java.io.Writer package first. Once we import the package, here is how we can create the writer.
Here, we have created a writer named output using the FileWriter class. It is because the Writer is an abstract class. Hence we cannot create an object of Writer.