我正在使用掃描程序逐行讀取文件。所以我的問題是,我們如何能夠將前一行並排存儲,因爲我們繼續前進到下一行。如何通過逐行讀取文件來獲取上一行
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