java最简单复制文件方法
把java2.txt内容复制到java.txt中
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
File f=new File("c:/java2.txt");
Path targetPath = Paths.get("c:/java.txt");
Files.copy(f.toPath(), targetPath, StandardCopyOption.REPLACE_EXISTING);