import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class readtxt { public static void main(String[] args) throws IOException { // FileReader fr = new FileReader("read.txt"); // BufferedReader br = new BufferedReader(fr); BufferedReader br = new BufferedReader(new FileReader("read.txt"));//使用匿名对象读取文本 int len=0; while((len=br.read())!=-1){ System.out.println((char) len); } br.close(); } }