[split] User input check 10-06-2013, 12:14 PM
#1
now it's me who have a question !!
in this code it will ask the user to enter his name :
what i wish to do is if the user enter a number instead of a name he gets an error and re-ask him to add his name i already know that i need to use while or do while for repeating the question but what to do to make it forbidden to use a number instead of a name ?
Code:
System.out.println("Hello there what's your name");
personsName = in.nextLine();
System.out.println("hello " + personsName);
in this code it will ask the user to enter his name :
- if i enter blackeagle it will say then hello blackeagle
- if i enter 123456 it will say hello 123456
what i wish to do is if the user enter a number instead of a name he gets an error and re-ask him to add his name i already know that i need to use while or do while for repeating the question but what to do to make it forbidden to use a number instead of a name ?
![[Image: blackeagle_zps6ad86521.gif]](http://i1363.photobucket.com/albums/r719/AmazeGotStyle/blackeagle_zps6ad86521.gif)