如何在java中以恒定的内存复杂度从文件(txt)中读取行?o(1)!
像这样的东西有o(n)m,但我需要o(1):
FileReader fr = new FileReader("myfile.txt");
BufferedReader br = new BufferedReader(fr);
for (long i = 0; i < n-1; i++ ) {
br.readLine();
}
System.out.println("Line content:" + br.readLine());
br.close();
fr.close();
暂无答案!
目前还没有任何答案,快来回答吧!