展开全部
import java.io.BufferedReader;import java.io.File;import java.io.FileReader;import java.io.FileWriter;import java.io.IOException; public class FileCopy { static final String fromeFile = "c:\\test1.txt"; static final String toFile = "c:\\test2.txt"; public static void main(String args[]) { try { BufferedReader read = new BufferedReader(new FileReader(new File(fromeFile))); FileWriter write = new FileWriter(new File(toFile), true); String temp; while((temp = read.readLine())!=null){ write.write(temp); } write.close(); read.close(); System.out.println("内容已从"+fromeFile+"复制追加到"+toFile); } catch (IOException e) { e.printStackTrace(); } }}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询