📄 cw3a.java
字号:
import java.io.*;
class cw3a
{
public static void main(String args[]) throws Exception
{
//take command line args as parameter
if(args.length>=1)
{
try{
//use BufferedReader and FileReader to read in file
BufferedReader inFile=new BufferedReader(new FileReader(args[0]));
String line;
//while read in file and print out each line into console
while((line=inFile.readLine())!=null)
System.out.println(line);
inFile.close();
}catch(IOException e){
System.out.println("an error["+e+"]");
}
}
else //orint out error message when no file and no command line
System.err.println("no such file");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -