我正在使用扫描程序逐行读取文件。所以我的问题是,我们如何能够将前一行并排存储,因为我们继续前进到下一行。如何通过逐行读取文件来获取上一行
while (scanner.hasNextLine()) {
line = scanner.nextLine();//this will get the current line
if (line.contains("path=/select")){
// So whenever I enter in this if loop or this loop is true, I also want to
have the previous line in any String variable. How can we achieve this?
}
任何建议,将不胜感激。
+1打我到标记。 – AusCBloke