?? 7.1fileexception.java
字號:
import java.io. *;
public class FileException{
public static void main(String args []){
int b;
try{ //監視可能產生異常的代碼段
FileInputStream fis = new FileInputStream("test.txt"); //打開一個文件
while((b=fis.read())!= -1) //循環讀取文件中的內容
System.out.print((char)b);
fis.close();
}
catch(Exception e){ //出現異常時處理
System.out.println ("出錯了,原因是:");
System.out.println (e.toString ());
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -