In your playGame() method: you loop until numberOfHits is less than 20, but you never increment numberOfHits in the loop, so it will always be less than 20. So, you've got an infinite loop.