Thursday, 5 September 2013

Restarting a scanner to count number of lines?

Restarting a scanner to count number of lines?

I'm using a scanner to get input like this: input = scanner.next(). Is
there a way to restart the scanner to go through it again in a loop like
so? while (scanner.hasNext()){ loopCounter++; scanner.nextLine() }
or is there some other way I should be doing this?

No comments:

Post a Comment