You seem to have created an infinite loop reason being that votecount
will never be equal to -1 since you are never changing it inside the loop.
What you need to do is to move the code where you ask and record the vote within the loop. But before doing votes[votecount]++
check to make sure that the user did not input -1
since this will cause an ArrayOutofBoundsException
. So you can loop for ever and when the user enters -1 you can break
the loop.