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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!