java scanner read all lines code example
Example: how to check the lines in a file java scanner
int count = 0;
while (scanner.hasNextLine()) {
count++;
scanner.nextLine();
}
int count = 0;
while (scanner.hasNextLine()) {
count++;
scanner.nextLine();
}