Question
Write a program in Java that checks the format of a special identifier passed through the command line argument args[0]. The special identifier has to
Write a program in Java that checks the format of a special identifier passed through the command line argument args[0]. The special identifier has to start with an uppercase letter. The rest characters of the identifier must be a letter, a digit, or a special character (!, @, #, $, %). The special identifier must contain at least a digit and a special character.
The output of the code will be either Legal id. or Illegal id..
Starter Code:
public class SpecialistIdentifier { public static void main(String[]args) { if(args.length==0) { System.out.println("Usage: need a command line argument to run!"); return; } } private static boolean isSpecialCharcter(char ch) { if(ch=='!' || ch=='@'|| ch=='#' || ch=='$' || ch=='%') return true; return false; } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started