When I read the number of lines in a file using Scanner/FileReader the output is always two more than the real total number.For e.g.,
I am new to java
I have started liking the languge.
The output is 4 instead of 2.Why is that?
Printable View
When I read the number of lines in a file using Scanner/FileReader the output is always two more than the real total number.For e.g.,
I am new to java
I have started liking the languge.
The output is 4 instead of 2.Why is that?