1 package testDate;
2 import java.io.FileNotFoundException;
3 import java.io.FileReader;
4 import java.io.IOException;
5 public class TestReadFile {
6 public static void main(String[] args) {
7 FileReader reader = null;
8 try{
9 reader=new FileReader("d:/a.txt");
10 char c1=(char)reader.read();
11 char c2=(char)reader.read();
12 System.out.println(""+c1+c2);
13 }catch(FileNotFoundException e){
14 e.printStackTrace();
15 }catch(IOException e){
16 e.printStackTrace();
17 }finally{
18 try {
19 if(reader!=null){
20 reader.close();
21 }
22 } catch (IOException e) {
23 e.printStackTrace();
24 }
25 }
26 }
27 }
![](https://images2017.cnblogs.com/blog/1076860/201712/1076860-20171208114217827-1237730978.png)