FileWriter file = new FileWriter("save.txt",true); //allow append

解决方案 »

  1.   

    FileWriter
    public FileWriter(String fileName,
                      boolean append)
               throws IOException
    Constructs a FileWriter object given a file name with a boolean indicating whether or not to append the data written. Parameters:
    fileName - String The system-dependent filename.
    append - boolean if true, then data will be written to the end of the file rather than the beginning. 
    Throws: 
    IOException - if the named file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason