. 1 Package the TEST;
2 Import java.io.BufferedWriter;
. 3 Import java.io.FileWriter;
. 4 Import java.io.IOException;
. 5 public class BufferedWriterDemo {
. 6 public static void main (String [] args) throws IOException {
. 7
. 8 Write ( "E: \\ 1.txt" ); // run the main method
. 9 }
10 public static void write (String path)
. 11 throws IOException {
12 is in the form // writing into the stream
13 BW = BufferedWriter, new new BufferedWriter, ( new new FileWriter (path));
14 // first write line
15 String SS = "Test Data" ;
16 bw.write (SS);
. 17 bw.newLine (); // wrap by
18 is
. 19 / / off stream
20 is bw.close ();
21 is System.out.println ( "successfully written" );
22 }
23 is
24
25 }