FileWriter(File file, boolean append)
建構函式具有以下語法。
public FileWriter(File file, boolean append) throws IOException
在下面的程式碼中展示了如何使用FileWriter.FileWriter(File file, boolean append)
建構函式。
import java.io.File;
// By: W W w .y IIb Ai .c O M
public class Main {
public static void main(String[] args) throws Exception {
FileWriter fileWriter = new FileWriter(new File("c:/abc.txt"),true);
fileWriter.append("tw511.com");
fileWriter.close();
}
}