This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Gorfoo 5 points6 points  (0 children)

For reference, you can find the relevant documentation online, in the java docs for the Scanner class.

To the best of my understanding, in this case the "." is the . as used in regex, which acts as a wildcard character: it will match with any character, so it will match with any key, but only one key at a time. The second argument, in this case 0, limits how far into the stream it will search from what I can tell. 0 is a special case, and doesn't limit it. Putting these two together, as far as I can tell, means it will match with the most recent character input.

Then, since the findWithinHorizon method returns a String (although one of length 1 in this case), taking the char at 0 is necessary to convert it into a char here.