0
Condition to check numbers up to 10 in java.
Please is there any condition that can check user input for a number of digits type. For example: With a mobile money service, if a user Input a number less or more than number of digits. ie 10 digits, there is a command prompt thrown to the user. Any help family?
1 Réponse
0
Simple way, By using long input, check is in range
if( in>=1000000000 && in<=9999999999)
Else Console.read() reads a single character. Use it in loop for 10 times....
Throw exception if unsuccessful..
or
expensive string form and use length function.
May be java graphical input read helps better..
Hope it helps..