重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
public static void main(String[]args)
{
File head=new File("D:/d/b");
File last=new File("D:/d/vv");
try(BufferedReader breader=new BufferedReader(new FileReader(head));
BufferedWriter bwriter=new BufferedWriter(new FileWriter(last))) {
//用新方法逐行读取
String line=null;
while((line=breader.readLine())!=null)
{
bwriter.write(line);//逐行写出
bwriter.newLine(); //每行写入一个换行符
bwriter.flush();
}
}catch(FileNotFoundException e)
{
e.printStackTrace();
}catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}