8000 java printwriter new line · TGAMendis/CoreJava@33e34cd · GitHub
[go: up one dir, main page]

Skip to content

Commit 33e34cd

Browse files
author
JavaProgramTo.com
committed
java printwriter new line
1 parent 0556f26 commit 33e34cd

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.javaprogramto.files.printwriter.newline;
2+
3+
import java.io.PrintWriter;
4+
5+
public class PrintWriterNewLine {
6+
7+
public static void main(String[] args) {
8+
9+
PrintWriter printWriter = new PrintWriter(System.out);
10+
11+
printWriter.write("this is the first line");
12+
printWriter.write("\n");
13+
printWriter.write("this is the second line");
14+
printWriter.write("\n");
15+
printWriter.write("third line");
16+
17+
printWriter.flush();
18+
19+
printWriter.close();
20+
21+
}
22+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.javaprogramto.files.printwriter.newline;
2+
3+
import java.io.PrintWriter;
4+
5+
public class PrintWriterNewLine2 {
6+
7+
public static void main(String[] args) {
8+
9+
PrintWriter printWriter = new PrintWriter(System.out);
10+
11+
printWriter.println("this is the first line");
12+
printWriter.println("this is the second line");
13+
printWriter.println("third line");
14+
15+
printWriter.flush();
16+
17+
printWriter.close();
18+
19+
}
20+
}

0 commit comments

Comments
 (0)
0