BufferedReader更快、更好的读取文件,对中文友好
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class demo01 {
public static void main(String[] args) throws IOException {
String str1="C:\\Users\\Administrator\\Desktop\\test.txt";
BufferedReader bufferedReader = new BufferedReader(new FileReader(str1));
String line;
while ((line=bufferedReader.readLine())!=null){
System.out.println(line);
}
bufferedReader.close();
}
}