package file.Buffered;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
public class BufferedWriter_ {
public static void main(String[] args) throws IOException {
String path = "d:\\ok.txt";
//创建BufferedWriter
//new FileWriter(path,true)这样代表追加
//new FileWriter(path)这样代表覆盖
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(path,true));
bufferedWriter.write("你好丁学刚");
//插入和系统相关的换行符
bufferedWriter.newLine();
bufferedWriter.write("你好丁学刚02");
bufferedWriter.newLine();
bufferedWriter.close();
}
}
无追加
有追加