public static void main(String[] args) {
try {
BufferedReader in = new BufferedReader(new FileReader("wangaw.txt"));
String str;
while ((str = in.readLine()) != null) {
System.out.println(str);
}
System.out.println(str);
} catch (IOException e) {
}
}
读取文件的内容
in.readLine()整行的读取,当读到为空的时候停止