public static void main(String[] args) throws IOException { // 一次读取一个字符 FileReader fr = new FileReader("a.txt"); int b; while ((b = fr.read()) != -1) { System.out.println((char)b); } fr.close(); // 一次读取多个字符 FileReader fr1 = new FileReader("a.txt"); int len; char[] c = new char[1024]; while ((len = fr1.read(c)) != -1) { System.out.println(new String(c)); } fr1.close(); }