How can I use BufferedReader to read all the lines between two specific lines. For example, I want to start reading from line1 then line2, can I use this code
BufferedReader reader = new BufferedReader(new FileReader("file.txt"));
String line1 = "StartLine";
String line2 = "EndLine";
while (!line1.equals(line2))
{
line1 = reader.readLine();
}
I am writing something like this, but it does not work! Please help me, I'm starting in Java!
source
share