Java FileWriter ClassJava 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. Java FileWriter class declarationLet's see the declaration for Java.io.FileWriter class: Constructors of FileWriter class
Methods of FileWriter class
Java FileWriter ExampleIn this example, we are writing the data in the file testout.txt using Java FileWriter class. Output: Success... testout.txt: Welcome to javaTpoint. Next TopicJava FileReader Class |