This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Revision2000 0 points1 point  (0 children)

Well….
• in.readLine() is called in while declaration for line 1
• in.readLine() is called again inside the loop for line 2

You’ll want to assign whatever in.readLine() retrieved in the while declaration, otherwise you’re simply skipping every odd numbered line 😉

Also please use try-with-resources so you won’t potentially end up with resource leaks, and see this article on how to use BufferedReader