开发者

how to write the newline character as a string to a file java

开发者 https://www.devze.com 2023-01-27 01:39 出处:网络
how can i write the newline 开发者_Python百科character as a string to a file java. For example i want to write the string to the file \"hello\\nworld\"

how can i write the newline 开发者_Python百科character as a string to a file java. For example i want to write the string to the file "hello\nworld" as it is to a file.

Thank you, Rana.


System.out.println("hello\\nworld");
System.out.println("hello\nworld");


Just a side note, you should be using System.getProperty("line.separator") rather than \n since this character is not always the system's line separator.


steven is right.

you can also retrieve a list of all properties by using following code:

System.getProperties().list(System.out);
0

精彩评论

暂无评论...
验证码 换一张
取 消