main.java
来自「java的经典例子」· Java 代码 · 共 27 行
JAVA
27 行
import java.io.*;
class Main {
public static void main(String[] args) {
if (args.length == 0) {
System.err.println("java Main <inputfile> <outputfile>");
System.exit(-1);
}
try {
FileInputStream in = new FileInputStream(args[0]);
FileOutputStream out = new FileOutputStream(args[1]);
byte[] buf = new byte[512];
int count;
while ((count = in.read(buf)) > 0) {
out.write(buf, 0, count);
}
in.close();
out.flush(); // Flush data
out.getFD().sync(); // Commit changes to disk
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?