can scanner be used to read a file line by line 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();
}