⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cw3a.java

📁 a Java program that reads a file containing instructions written in self-defined file (TPL in this c
💻 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 + -