Problem is it is reteiving the data from the file .But when it enters the while loop .It does nt compares the string in the if condition .I have tried using compareTo() and equals() also.But it is not comparing the string s.Also after reading 2 lines the reader goes to the third line and brings a blank space . which it should not show.