// Java FileWriter class is used to write character-oriented data to a file.
// It is character-oriented class which is used for file handling in java.
// Unlike FileOutputStream class,
// you don't need to convert string into byte array
// because it provides method to write string directly.
import java.io.FileWriter;
class JavaFileWriterDemo {
public static void main(String[] args) {
try {
FileWriter fw = new FileWriter("filewriter.txt");
fw.write("File writer write char string directly");
System.out.println("Write operation executed succesfully");
fw.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}