好象有个append方法,试试看。

解决方案 »

  1.   

    public String AppendStr(String s){
            try{
                FileWriter f=new FileWriter(filePath,true);
                PrintWriter out=new PrintWriter(f);
                out.print("\n"+s+"\n");
                out.close();
                f.close();
                return "OK";
            }catch(IOException ioe){
                return ioe.toString();
            }这个是我做的,是JSP上的东东,原理差不多了
      

  2.   

    import java.io.*;
    public class Write1 
    {
        public static void main(String args[]) throws IOException
        {
         FileWriter f = new FileWriter("write1.txt",true);
    PrintWriter out = new PrintWriter(f);
    out.write("abcaaaa"+"\n");
    out.close();
        }
    }
      

  3.   

    文件操作构造函数中有个boolean值,是用来设置追加文件还是全新写入的,
    设了就OK了