?? showfile.java
字號:
//創建FileInputStream對象,讀取一個文本文件,并輸出其內容。
import java.io.*;
class ShowFile {
public static void main(String args[])
throws IOException
{
int i;
FileInputStream opfis;
//捕獲異常,判斷文本文件是否存在
try {
opfis = new FileInputStream("test11_1.txt");
} catch(FileNotFoundException exc)
{
System.out.println("File Not Found");
return;
}
// 從文本文件讀取數據
do {
i = opfis.read();
if(i != -1) System.out.print((char) i);
} while(i != -1);
opfis.close();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -