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

📄 myfirstfilereadingapp.java

📁 Reads/writes text as a character stream, buffering characters so as to provide for the efficient rea
💻 JAVA
字号:
import java.io.*;

public class MyFirstFileReadingApp
{
	// Main method
	public static void main (String args[])
	{
		// Stream to read file
		FileInputStream fin;		

		try
		{
		    // Open an input stream
		    fin = new FileInputStream ("myfile.txt");

		    // Read a line of text
		    System.out.println( new DataInputStream(fin).readLine() );

		    // Close our input stream
		    fin.close();		
		}
		// Catches any error conditions
		catch (IOException e)
		{
			System.err.println ("Unable to read from file");
			System.exit(-1);
		}
	}	
}

⌨️ 快捷键说明

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