| [ Web Proxy ] |
| Viewing: https://raw.githubusercontent.com/pooja2405/Java-Programs/master/WriteToTextFile.java | [Back] [Original] |
import java.io.FileWriter;
import java.io.IOException;
public class WriteToTextFile {
public static void main(String[] args) {
try {
FileWriter writer = new FileWriter("myfile.txt", true);
writer.write("Writing to a text file in Java");
writer.write("\r\n"); // write new line
writer.write("See you! Bye");
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
| Web Proxy Viewer | New URL | Original Page |