Class FileWriter - The FileWriter is a class used for writing character files.
Class BufferedWriter - The BufferWriter class is used to write text to a character-output stream, buffering characters. It will help us to provide for the efficient writing of single characters, arrays, and strings.
import java.io.*;
class FileWrite
{
public static void main(String args[])
{
try{
// Create file
FileWriter fstream = new FileWriter("out.txt");
BufferedWriter out = new BufferedWriter(fstream);
out.write("Hello Java");
//Close the output stream
out.close();
}catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}
}
}
Loading...
|
Comments :
Post a Comment