展开全部
import java.io.*;
public class fileDemo
{
public static void main(String[] args)throws IOException
{
File file1=new File("c:\\11.txt");
File file2=new File("c:\\12.txt");
FileInputStream fis=new FileInputStream(file2);
InputStreamReader isr=new InputStreamReader(fis);
FileOutputStream fos=new FileOutputStream(file1,true);
OutputStreamWriter osw=new OutputStreamWriter(fos);
int c;
while((c=isr.read())!=-1)
{
osw.write((char)c);
}
isr.close();
osw.close();
}
}
此 程序 是将12.txt的内容合并到11.txt
public class fileDemo
{
public static void main(String[] args)throws IOException
{
File file1=new File("c:\\11.txt");
File file2=new File("c:\\12.txt");
FileInputStream fis=new FileInputStream(file2);
InputStreamReader isr=new InputStreamReader(fis);
FileOutputStream fos=new FileOutputStream(file1,true);
OutputStreamWriter osw=new OutputStreamWriter(fos);
int c;
while((c=isr.read())!=-1)
{
osw.write((char)c);
}
isr.close();
osw.close();
}
}
此 程序 是将12.txt的内容合并到11.txt
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询