Java - Twitter Username Check

Published on 12 April 2022 at 00:56

A Java program that will check the validity of an inputted Twitter username.

deals with:

  • Looping using bool flag
  • Nested flow control
  • Dynamic ArrayLists
  • JOptionPane from javax
  • Running code from seperate class (Instantiated in main)



Download the Code: GitHub

Program Run-Through

Upon start user is prompted for name

Twitter names must begin with @ and contain only letters, numbers, and _

When user tries to proceed with the previous, it is marked as invalid

Again this is invalid as it contains special chars

This is invalid as it exceeds the 16 character limit

Valid name

Valid Name

Terminate the program by inputting n at prompt

At termination, program shows the list of valid and invalid names entered by the user