- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNewLineTest.java
More file actions
Latest commit
29 lines (25 loc) · 919 Bytes
/
Copy pathNewLineTest.java
File metadata and controls
29 lines (25 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
packagemanipulations;
importorg.junit.jupiter.api.Test;
publicclassNewLineTest {
@Test
publicvoidnew_line_window() {
Stringline1 = "Humpty Dumpty sat on a wall.";
Stringline2 = "Humpty Dumpty had a great fall.";
Stringrhyme = line1 + "\r" + line2;
System.out.println(rhyme);
}
@Test
publicvoidnew_line_by_system_option() {
Stringline1 = "Humpty Dumpty sat on a wall.";
Stringline2 = "Humpty Dumpty had a great fall.";
Stringrhyme = line1 + System.lineSeparator() + line2;
Stringrhyme2 = line1 + System.getProperty("line.separator") + line2;
System.out.println(rhyme);
System.out.println(rhyme2);
}
@Test
publicvoidnew_line_by_character() {
Stringrhyme = String.format("Humpty Dumpty sat on a wall.%nHumpty Dumpty had a great fall.");
System.out.println(rhyme);
}
}