We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d6405e1 commit d2c73d8Copy full SHA for d2c73d8
1 file changed
WriteToTextFile.java
@@ -0,0 +1,20 @@
1
+import java.io.FileWriter;
2
+import java.io.IOException;
3
+
4
5
+public class WriteToTextFile {
6
7
+ public static void main(String[] args) {
8
+ try {
9
+ FileWriter writer = new FileWriter("myfile.txt", true);
10
+ writer.write("Writing to a text file in Java");
11
+ writer.write("\r\n"); // write new line
12
+ writer.write("See you! Bye");
13
+ writer.close();
14
+ } catch (IOException e) {
15
+ e.printStackTrace();
16
+ }
17
18
19
20
+}
0 commit comments