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

📄 simplethrows.java

📁 国外的数据结构与算法分析用书
💻 JAVA
字号:
import java.io.*;

/**	A simple program that reads in its own source code and displays it to the
	console.  The program will crash if it encounters any errors. */
public class SimpleThrows
{
	/**	 Returns the contents of the file pointed to by the parameter. */
	public static String readFile(String file) throws IOException
	{
		FileReader fr = new FileReader(file); // can throw an exception
		BufferedReader br = new BufferedReader(fr);
		String temp, result = new String();
		while ((temp = br.readLine()) != null) // can throw an exception
			result += temp + "\n";
		br.close();
		return result; // return file contents
	}

	public static void main(String[] args) throws IOException
	{
		System.out.println(readFile("SimpleThrows.java"));
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -