【发布时间】:2015-10-08 15:52:54
【问题描述】:
我有一个程序让我们说 x 不断使用 file.write() 向 .txt 文件添加值。
另一方面,我有一个程序会继续从早期的 .txt 文件中读取当前添加的条目。
但我想阅读当前条目以及前两个条目。
以编程方式,这就是我想要的。
for (100 iterations)
{
prog named x ----> this code will enter a value to a .txt file and that too one entry per line.
prog named y-----> this code will read the just entered value as well as the previous two entries , so all in all we will read three lines and do some computations based on these three values lets say we will take average.
}
任何帮助将不胜感激。
【问题讨论】:
-
你真的需要重新读取之前的两个值吗?也许你可以简单地记住它们?
-
不,我想要问题中描述的方式。
标签: java bufferedreader