Question: Write a function that accepts one parameter and test to see if the input parameter to the function is a legitimate java identifier. Write a

Write a function that accepts one parameter and test to see if the input parameter to the function is a legitimate java identifier.

Write a function that accepts one parameter and test to see if

Write a class which has two methods:

legitimateJavaIdentifiter (String parameter) {//statement to check parameter}

main function to test the legitimateJavaIdentifiter (String parameter) function.

Output the results

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- HINT:

Main (){

String parameter; // ask user to type the parameter from keyboard or initialize the parameter by assignment.

Function legitimateJavaIdentifiter (Parameter);

// output the results

}

boolean LegitimateJavaIdentifiter (String parameter){

// Returns TRUE if parameter is a legal Java identifier,

// Otherwise returns FALSE

if (parameter is identifier) // The elements in the identifier follow the rules

//hints: check the Unicode of characters

return true;

else

return false;

}

Java Identifiers All Java components require names. Names used for classes, variables, and methods are called identifiers. In Java, there are several points to remember about identifiers. They are as follows All identifiers should begin with a letter (A to Z or a to z), currency character or an underscore After the first character, identifiers can have any combination of characters. A key word cannot be used as an identifier. Most importantly, identifiers are case sensitive. o Examples of legal identifiers: age, $salary, Value, 1 value Examples of illegal identifiers 123abc, salary

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!