Is it possible to allow only letters or numbers in a string in java ? for example :
String Text;
Text = jTextField1.getText();
now
if (Text is a number) {System.out.println("Invalid Input");}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
you have two choices to use
JFormattedTextField with proper
FormatterorInputVerifieruse DocumentFilter
String Text;(possible reserved word for API name or its method) useString text;more in the Naming convention