这是代码:
File file = new File("Hello.txt");
file.createNewFile();
FileWriter write = new FileWriter(file);
BufferedWriter bufWrite = new BufferedWriter(write);
bufWrite.write("HelloWorld");
bufWrite.flush();
bufWrite.close();
FileReader read = new FileReader(file);
BufferedReader bufRead = new BufferedReader(read);
while(bufRead.read()!=-1){
System.out.println(bufRead.readLine());
}
bufRead.close();
在这里,输出是 elloWorld。“H”不在那里。为什么会这样?不知道我在这里做错了什么!