因为你创建的是一个不带自动刷新的printWriter ,要用flush()刷新,这样就可以了- public class Empty
- {
- public static void main(String[]args)
- {
- File file = new File("1.txt");
- try
- {
-
- PrintWriter out = new PrintWriter(file);
- out.println("ff");
- out.flush();
- }
- catch( FileNotFoundException e)
- {
- }
- }
- }
复制代码 |