The first for loop in Example 9-8 is missing an open curly bracket.

Incorrect:

for (int i = 0; i < xpos.length; i++)
  xpos[i] = 0;
  ypos[i] = 0;
}

Correct:

for (int i = 0; i < xpos.length; i++) {
  xpos[i] = 0;
  ypos[i] = 0;
}

Also, in the code hint "elements" is spelled incorrectly ("elemets"). It should be:

Declare two arrays with 50 elements each.