📄 translate.java.bak
字号:
import java.io.*;
class Translate {
public static void main(String[] args) {
InputStream in = System.in;
OutputStream out = System.out;
if (args.length != 2) {
this.error("from / to needed");
}
String from = args[0], to = args[1];
int ch,i;
if (from.length() != to.length()) {
error("same length needed");
}
try {
while ( (ch = in.read()) != -1) {
if ( (i = from.indexOf(ch)) != -1) {
out.write(to.charAt(i));
}
else {
out.write(ch);
}
}
}
catch (IOException e) {
error("I / O Exception : " +e);
}
}
public static void error(String err) {
System.err.print("Translate : "+err);
System.exit(1); //非零值意指“不好”
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -