Quiz: Finding the Position of the First Match
Instead of starting position with -1, you can use the following loop:
int position = 0;
while (in.hasNext())
{
String word = in.next();
if (word.length() > 60)
{
longWord = word;
found = true;
}
else
{
position++;
}
}