?? readfileexample.java
字號:
//Chapter 03, sample 35
//ReadFileExample.java
//Read a file.
package javaio;
import java.io.*;
public class ReadFileExample
{
public static void main(String[] args)
{
try
{
ReadFileExample example=new ReadFileExample();
//得到當(dāng)前源程序的文件名
String fileName=example.getClass().
getResource("ReadFileExample.java").toString();
FileInputStream in = new FileInputStream(new File(fileName));
//當(dāng)文件沒有結(jié)束時每次讀取一個字節(jié)顯示
while (in.available()>0)
{
System.out.print((char)in.read());
}
in.close();
}
catch (IOException e)
{
System.out.println(e.toString());
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -