How to enter numerical data?

If there is no explicit assignment to it, like calling a 'getKey' method, then the value of 'key' can't change within the loop.
korman's code did such an assignment, yours doesn't.