What's the JAVA code If i want from the user to write their contact number that should be just 10 digits?!!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What's the JAVA code If i want from the user to write their contact number that should be just 10 digits?!!!

What's the JAVA code If i want from the user to write their contact number, and if the contact number less or more than 10 digits the program will display "Sorry, the contact number should be 10 digits!" Such like this output: Enter you contact number: 05703133 Sorry, the contact number should be 10 digits!

11th Oct 2019, 9:17 AM
RazanAbuawf
RazanAbuawf - avatar
1 Answer
+ 2
since you have learn Java try to write something instead of asking for the whole thing, you can create a function that reads amount of digits inputed or use a string to get user input and then convert to integer
11th Oct 2019, 9:54 AM
✳AsterisK✳
✳AsterisK✳ - avatar