Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.nio.channels.FileChannel;

public class Main {
    public static void main(String[] args) throws Exception {
        String fromFileName = "from.txt";
        String toFileName = "to.txt";
        FileChannel in = new FileInputStream(fromFileName).getChannel();
        FileChannel out = new FileOutputStream(toFileName).getChannel();
        in.transferTo(0, (int) in.size(), out);
        in.close();
        out.close();
    }
}