- package itheima;
- import java.io.BufferedWriter;
- import java.io.FileWriter;
- import java.io.IOException;
- public class day_19_1 {
- public static void main(String[] args) throws IOException {
- FileWriter fw = new FileWriter("bufw.txt");
- BufferedWriter bufw = new BufferedWriter(fw);
- bufw.write("addddddd");
- bufw.close();
- if(fw==null){
- System.out.println("fw已关闭");
-
- }else
- {
- System.out.println("fw没有关闭");
- }
- }
- }
复制代码 视频中老师说调用BufferedWriter 的close()方法就可以关闭FileWriter 的fw流
可是关闭后,为什么fw还是不为空?关闭后fw的值是什么,还是已经消失了?
|
|