知乎专栏 |
package cn.netkiller.io; import java.io.FileNotFoundException; import java.io.PrintWriter; public class PrintWriterTest { public PrintWriterTest() { // TODO Auto-generated constructor stub } public static void main(String[] args) throws FileNotFoundException { // TODO Auto-generated method stub PrintWriter output = new PrintWriter("temp.txt"); output.print("Welcome to Java!"); output.close(); } }