PrintWriter close()
来源:互联网 发布:mac os x常用软件 编辑:程序博客网 时间:2024/04/29 00:06
File file=new File("a.txt"); //1
PrintWriter writer=new PrintWriter(file); //2
String text="?";
writer.write(text); //3
//
writer.close() //4
如果a.txt不存在,程序运行到2时,才创建文件。
运行到3时,不会立即把内容写入a.txt
运行完4
writer.close() 才会写入内容。close() 很重要一定要正确关闭
0 0
- PrintWriter close()
- PrintWriter
- PrintWriter
- PrintWriter
- PrintWriter
- PrintWriter
- printwriter
- PrintWriter
- PrintWriter
- close ()
- close()
- StringWriter/PrintWriter
- StringWriter/PrintWriter
- [Java] PrintWriter
- PrintWriter类
- Printwriter对象
- JAVA PrintWriter
- BufferReader.PrintWriter
- RAC环境下NTP导致的VKTM detected a time drift
- 使用 Cocos2d-x 和粒子编辑器实现
- 黑马程序员——Java高新技术---枚举、内省、类加载器、注解
- Android之Monkey测试
- Ubuntu学习笔记(二)
- PrintWriter close()
- 关于webshell
- SqlServer 并发事务(二):锁粒度和锁模式
- EXCEL&VBA: 中国热力图 HeatMap of China
- ICS Malloc Lab: Writing a Dynamic Storage Allocator
- [leetcode]Anagrams
- NSDate
- 悼念512汶川大地震遇难同胞——来生一起走
- 经典的0、1背包