如何将换行符作为字符串写入文件java

ran*_*123 0 java

如何将换行符作为字符串写入文件java.例如,我想将字符串写入文件"hello \nworld",因为它是一个文件.

谢谢你,拉娜.

cam*_*ckr 6

System.out.println("hello\\nworld");
System.out.println("hello\nworld");
Run Code Online (Sandbox Code Playgroud)