import java.io.*;
class BufferedWriterDemo
{
public static void main(String[] args) throws IOException
{
FileWriter fw = new FileWriter("buf.txt");
BufferedWriter bufw = new BufferedWriter(fw);
for(int x=1;x<5;x++)
{
bufw.write("abcd" + x);
bufw.newLine();//直接调用,在文本中的作用相当于Enter键(换行符)
bufw.flush();
}
bufw.flush();
}
}
|