Why do you have a ; after the while clause? That will just do nothing (; is a valid statement in java though it does nothing in this case.)