Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8783819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:55:36+00:00 2026-06-13T20:55:36+00:00

For my project I need to input a first and last name with no

  • 0

For my project I need to input a first and last name with no numbers but I simply can’t find anything online. If you could help, that would be terrific.

Also if you have the time, I need to flip the first and last name with a comma when the user inputs them.

    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.io.IOException;

    public class PhoneListr {

public static void main (String[] args) throws IOException {
    String firstName;
    String lastName;
    System.out.println ("Please enter your first name:");
    firstName = PhoneList ("");
    System.out.println ("Please enter your last name:");
    lastName = PhoneList ("");
    System.out.println ("Your full name is: " + lastName + "," + firstName);
}

public static String PhoneList (String input) throws IOException {
    boolean continueInput = false;

    while (continueInput == false) {

            BufferedReader bufferedReader = new BufferedReader (new InputStreamReader (System.in));
            input = bufferedReader.readLine();
            continueInput = true;

            if(input.matches("[a-zA-Z]+")) {
                continueInput = true;
                    }
                  else {
                 System.out.println ("Error, you may only use the alphabet");
                 continueInput = false;
        }
    }
    return input;
}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T20:55:38+00:00Added an answer on June 13, 2026 at 8:55 pm

    use String.matches(regex):

        if(input.matches("[a-zA-Z]+")) {
         System.out.println("your input contains no numerics");
            }
          else {
         System.out.println("only alphabets allowed");
    }
    

    the above regex checks a through z, or A through Z, inclusive (range).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a field that a user can input first and last name to
In my project i need to take an expression input from user as string
I need jar files for java.util.regex in my project for input validation if any
I'm beginning one of my first C# projects--need to find the curve fit for
All: I'm seeking input/guidance/and design ideas. My goal is to find a lean but
I need to make a search page for some project. Input fields are: <h:inputText
I am bootstrapping myself through my very first ASP MVC project, and could use
I'm working on my first Django project. I need to connect to a pre-existing
my project need to read multiple web pages at a time(eg: for a particular
My project need to compare output(only urls) of google and yahoo for a particular

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.