📄 myfirstfilereadingapp.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 + -