MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

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

public class MainClass {
    public static void main(String[] args) throws Exception {
        FileChannel in = new FileInputStream("source.txt").getChannel(),
                out = new FileOutputStream("target.txt").getChannel();
        in.transferTo(0, in.size(), out);
        // Or:
        // out.transferFrom(in, 0, in.size());
    }
}