Java Reader copy to Writer

Description

Java Reader copy to Writer

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;

public class Main {
   public static void main(String args[]) throws IOException {
      Reader in = new FileReader("Main.java");
      Writer out = new FileWriter("Main1.java");
      int c;/*w w w  .j av  a 2 s .  c  o m*/
      while ((c = in.read()) != -1)
         out.write(c);
      in.close();
      out.close();
   }
}



PreviousNext

Related