Discuss / Java / copy文件的程序作业

copy文件的程序作业

Topic source

WLjustdo

#1 Created at ... [Delete] [Delete and Lock User]

import java.io.*;

public class Main {

    public static void main(String[] args) throws IOException {

        try(OutputStream output = new FileOutputStream(args[1])) {

            try(InputStream input = new FileInputStream(args[0])) {

                int n;

                while((n = input.read()) != -1){

                    output.write(n);

                }

            }

        }

    }

}


  • 1

Reply