Java 添加字符串到文件尾2 Java 添加字符串到文件尾 Java 拷贝文件 Java 添加字符串到文件尾2 import java.io.File; import java.io.FileWriter; import java.io.BufferedWriter; import java.io.IOException; public class AppendToFileExample { public static void main( String[] args ) { try { String data = " Tutorials Point is a best website in the world"; File f1 = new File("C:\\Users\\codingdict7\\Desktop\\abc.txt"); if(!f1.exists()) { f1.createNewFile(); } FileWriter fileWritter = new FileWriter(f1.getName(),true); BufferedWriter bw = new BufferedWriter(fileWritter); bw.write(data); bw.close(); System.out.println("Done"); } catch(IOException e) { e.printStackTrace(); } } } Java 添加字符串到文件尾 Java 拷贝文件