java 写入文本文件txt BufferedWriter

public void BufferedWriterTest() throws IOException{
String temp = "测试写入";
BufferedWriter buff = new BufferedWriter(new FileWriter("D:/my.txt"));
for (int i=0;i<10;i++) {
buff.write(temp);
buff.newLine();

}
buff.flush();
buff.close();
System.out.println("写入ok");
}


黑色头发:http://heisetoufa.iteye.com/

你可能感兴趣的:(java 写入文本文件txt BufferedWriter)