ADD file via upload

master
pj3q7x5mz 2 years ago
parent e4fa01b824
commit d9a00cb6d4

@ -0,0 +1,24 @@
import java.io.*;
import java.util.Scanner;
public class FileTest {
public static void main(String[] args) throws IOException {
// 请在Begin-End间编写完整代码
/********** Begin **********/
// 使用字节输出流和输入流,把给定文件里的内容复制到另一个给定文件中
Scanner input = new Scanner(System.in);
String path1 = input.next();
String path2 = input.next();
FileInputStream fis = new FileInputStream(path1);
FileOutputStream fos = new FileOutputStream(path2);
int a = 0;
while((a=fis.read())!=-1){
fos.write(a);
}
fis.close();
fos.close();
/********** End **********/
}
}
Loading…
Cancel
Save