阅读背景:

如何通过验证用户的输入只是数字向数组添加元素?

来源:互联网 

I'm trying to add 3 elements to my array, but I want to make sure that user's input are ONLY numbers. So far I have my for loop that allows the user to enter 3 numbers and if the user enters an input that IS NOT A NUMBER I subtract 1 so I still make sure I only get 3 numbers. After running my code I get an Exception error (Exception in thread "main" java.util.InputMismatchException). Please someone tell me what I'm doing wrong. Thank you in advance! I'm trying to add 3 elements to my array, but I




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: