How can I use BufferedReader for reading all lines between two concrete line. for example i want to start reading from line1 то line2, can I use this code
BufferedReader reader = new BufferedReader(new FileReader("file.txt"));
String line1 = "StartLine";
String line2 = "EndLine";
while (!line1.equals(line2))
{
// do something
line1 = reader.readLine();
}
I write something like this, but it does not working! Please help me, I am beginner in Java!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…