I'm new to java and I'm wondering if there is a different method that I can use instead of has.nextInt() as this method messes up my scanner. For example
do {
System.out.println("Please enter your full name: ");
memberName = input.nextLine();
if (input.hasNextInt()) {
System.out.println("Your name cannot contain a number");
input.next();
} else {
successful = true;
}
} while (successful == false);
console
Create new member
Please enter your full name:
jack
jack
I have to enter my name twice before it moves on I know theres questions out there like this but I've had no luck with any of there solutions. Thanks
EDIT
I'm trying to make sure that the input does not contain any number at all and if it does then
System.out.print("Your name cannot contain any numbers");
happens