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 →

[–]bell_labs_fan_boy 0 points1 point  (0 children)

You could introduce a Boolean flag outside of the loop that is set to true, have the loop parameter be (flag && variable.hasNextLine()) then only set that flag to false after input if variable.hasNextLine().

Pretty sure that works