This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
That while condition is rather complex the first time you see one like it. This part:
( line = input.readLine() )
reads one line of text into a variable called line. An assigment clause like that also has a value, which is the value of the variable just assigned. The second part of the while condition compares that to null. Null means we tried to read but we were at the end of file and got nothing.
You wanted to get two variables, line1 and line2. I didn't do that. This more general solution puts lines read into a collection or an array so it can handle any number of lines.
Did that help?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: May 24, 2006
Thanks for reply. I'll try it out now, and will let you know if I am able to make it to work or not.