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 String str = null;
8 try {
9 str = new TestReadFile().openFile();
10 } catch (IOException e){
11 e.printStackTrace();
12 }
13 System.out.println(str);
14 }
15 String openFile() throws FileNotFoundException,IOException{
16 FileReader reader = new FileReader("d:/a.txt");
17 char c= (char) reader.read();
18 System.out.println(c);
19 return "";
20 }
21 }