我将如何像System.out.println(“ words”)一样在纸上打印一个简单的段落?使用打印机将其放入.txt文件中并从那里进行打印也是可行的选择。
答案 0 :(得分:0)
可能重复吗? How do I create a file and write to it in Java?
PrintWriter writer = new PrintWriter("the-file-name.txt", "UTF-8");
writer.println("The first line");
writer.println("The second line");
writer.close();