What does your program do if you enter invalid data?
Type: Posts; User: Norm
What does your program do if you enter invalid data?
First you must define what values are invalid.
Then you can write code to detect them.
Try it and see what happens:
System.out.println("valueOf123=" + Integer.valueOf("123"));
What are you trying to do with a String and the % operator?
What would the results of "hi there" % 4 be?
It makes no sense.
If the String contains numeric digits: "123" then use an Integer...