import java.io.*;
class file1
{
public static void main(String arg[])
{
File inf = new File("in.dat");
File outf = new File("out.dat");
FileReader ins = null;
FileWriter outs = null;
try
{
ins = new FileReader(inf);
outs = new FileWriter(outf);
int ch;
while((ch=ins.read())!=-1)
{
outs.write(ch);
}
}catch(IOException e)
{
System.out.println(e);
System.exit(-1);
}
finally
{
try
{
ins.close();
outs.close();
}
catch(IOException e)
{ }
}
}
}Java
Read The Data from One File and Write The Data to another File using Java

Written by
View ProfileSenthilvelan Sambamoorthy
Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.
