Reading lines and then comparing them

Hello

I want to read two lines of a file, and then compare them. At the present time, I have implemented:
String line = null;
String currentLine = null;
String prevLine = null;

BufferedReader bf = new BufferedReader(new FileReader(fileA));
while ((line=bf.readLine()) != null)
        {    
            currentLine = line;
            prevLine = line;
        }
I understand that this code returns the same line, but I was just hoping that maybe someone could point me in the right direction. Thanks in advance.
prevLine = currentLine;
currentLine = line;

Be sure to check for null in the comparison.

DB

Tags: Java

Similar Questions

Maybe you are looking for