import java.io.*;
public class test {
public static void main(String[] args) throws IOException
{
//重点在new FileWriter中的boolean参数,为false时本次写入将覆盖文件中原来的内容,为true时在则原来的基础上追加新的内容
BufferedWriter br=new BufferedWriter(new FileWriter("c:/a.txt",false));
br.append("*");
br.close();
}
}
|