What I am trying to do is to get my program to read the number of lines that contains LOOP with spaces
Try Like this.
if (scanner.nextLine().contains("LOOP with spaces"))
{ iterated++; }
- nextLine()
This method will read whole line.
String line=scanner.nextLine();
- next()
This will return next token in file means
next()
can read the input only till the space.
String token=scanner.next();