/*
 * FileReaderWriter.java
 *
 * Created on October 2, 2007, 6:16 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
import java.io.*;
/**
 *
 * @author Admin
 */
public class FileReaderWriter {
   
    /** Creates a new instance of FileReaderWriter */
    public FileReaderWriter() {
    }
   
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        // TODO code application logic here
                File inputFile = new File("farrago.txt");
        File outputFile = new File("outagain.txt");
       
        FileReader in = new FileReader(inputFile);
        FileWriter out = new FileWriter(outputFile);
        int c;
       
        while ((c = in.read()) != -1){
            System.out.println(c);
            out.write(c);
        }
       
        System.out.println("FileReader is used to read a file and FileWriter is used for writing.");
       
        in.close();
        out.close();

    }
   
}