scanner number of lines of a file java 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();
}