new FileWriter(File file) : FileWriter « java.io « Java by API






new FileWriter(File file)

 
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    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)
      out.write(c);

    in.close();
    out.close();
  }
}

   
  








Related examples in the same category

1.new FileWriter('LPT1:')
2.new FileWriter(String string)
3.new FileWriter(String fileName, boolean append)
4.FileWriter: close()
5.FileWriter: flush()
6.FileWriter: write(int i)