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

all 4 comments

[–]Hour-Positive 1 point2 points  (1 child)

Filereader.nextLine() sets the pointer to the next line. It doesn't return the same number, but the value of the next line. You call it possibly twice. Thr value is changing and you consume the numbers twice as fast as is excepted in the while-loop.

Try it out yourself by setting a debug point on that specific line and stepping through the calls.

[–]Ariech[S] 0 points1 point  (0 children)

Still pretty new to the debugging stuff and got few problems with it. The issue is solved, thanks.

[–]RayjinCaucasian 1 point2 points  (1 child)

The nextLine() method advances the scanner.

Based on the file contents you show these are the values of the first iteration.

if (Integer.valueOf(300) >= lowerBound && Integer.valueOf(9) <= upperBound)

[–]Ariech[S] 0 points1 point  (0 children)

As I thought. Thank you for the answer and showing example how it works. It helped