This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring Boot in Practice and have Somnath Musib on-line!
See this thread for details.
Win a copy of Spring Boot in Practice this week in the Spring forum!

kiranmayi Talusani

Greenhorn
+ Follow
since Feb 01, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by kiranmayi Talusani

Divya,
I think your program is only comparing first line from the first file with all the lines from the second file,because the value of 'str' becomes 'null'.
when the program's execution comes out of the second(inner) while loop the value of 'str' will become 'null'. Then it will read second line from frist file.But it will not enter into the second(inner) while loop because the value in str is 'null'. so it will read all the lines from first file util the value in 'line' becomes 'null' and then it comes out of the first(outer) while loop.
18 years ago
divya,
First your program is comparing first line from first file with all the lines from second file.

After that it is comparing all the lines from the first file with the last line(after first line is compared with all the lines from second file, the value in "str" will be last line from second file) from second file.I guess that is the reason you are not seeing the currect output.
18 years ago