Example & Tutorial understanding programming in easy ways.

How to Write file handling program to copy characters from one file to another in java?.

Example: copy characters from one file to another in Java
 

import java.io.*;

class CopyChartest

{

public static void main(String[] args)

{

File infile = new File("my java.txt");

File outfile = new File("hello java.txt");

FileReader fr=null;

FileWriter fw=null;

try{

fr = new FileReader(my java);

fw = new FileWriter(hello java);

int ch;

//FileReader Class which is subclass of InputSteamReader//

fw.write(ch);}

}catch(IOException e){

System.out.println(e);

System.exit(-1);}

finally{

try{

fr.close();

fw.close();

}

catch(IOException e){}

}}}

Read More →
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!