Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1aa0d93

Browse files
Create README.md
1 parent 3233777 commit 1aa0d93

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

‎README.md‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# SpringBootMultiLineString
2+
Spring Boot MultiLine string example
3+
4+
@SpringBootApplication
5+
public class Main implements CommandLineRunner {
6+
7+
public static void main(String[] args) {
8+
9+
SpringApplication.run(Main.class, args);
10+
System.out.println("I am in");
11+
12+
}
13+
14+
public void run(String... args) throws Exception {
15+
16+
//Creating string reporte
17+
18+
String reporte = "";
19+
for (int i = 0; i < 10; i++) {
20+
21+
reporte = reporte +"Line"+i+ "\n";// Line1\nLine2\n.......
22+
}
23+
//Creating file.txt saving the string and defining as multiline
24+
25+
FileWriter fileWriter = new FileWriter("file.txt", true);
26+
BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
27+
bufferedWriter.write(reporte + "\n");
28+
bufferedWriter.flush();
29+
bufferedWriter.close();
30+
fileWriter.close();
31+
32+
}
33+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /