public FileWriter(File file,boolean append) throws IOException
Constructs a FileWriter object given a File object. If the second argument is true, then bytes will be written to the end of the file rather than the beginning.
Constructs a FileWriter object given a File object. If the second argument is true, then bytes will be written to the end of the file rather than the beginning.
import java.io.*;
public class FWT {
public static void main (String [] args) {
try {
FileWriter filewriter1 = new FileWriter("1.txt",true);
String s1 = "hello,thank u for your help";
filewriter1.write(s1);
String s2 = "good luck";
filewriter1.write(s2);
}
catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
mport java.io.*;
public class NewLineWrite{
public static void main(String args[]) throws Exception{
String name="haoqingshi";
FileWriter fw=new FileWriter("c:\\words.txt",true);
BufferedWriter out = new BufferedWriter(fw);
out.newLine(); //新行!
out.write(name);
out.close(); }
}
我见你说“吖吗嗲..........”,我有个同学他也是这么喊的,:-)