File f = new File("output.txt");
FileWriter write = new FileWriter(f, false);
//True -- is to append the data
//False -- to write a file
BufferedWriter bw = new BufferedWriter(write);
bw.write("Hello World"); // Writing to file
bw.newLine(); //go to new line
bw.write("How are you");
bw.close(); // Closing the bufferedWriter
No comments:
Post a Comment