Write a Java application that helps a programmer check that the name to be used for a variable is syntactically correct. The rule for a valid Java name (called an identifier and is described on page 35 of the textbook) is a sequence of letters, digits, underscores (_) and dollar ($) signs. In addition, the first character of the name can be any one of these characters except it cannot be a number. Finally, if the name begins with the letter, then it should be a lowercase letter.

For this application, use a for loop to go through each character in the String object containing the name to check entered by the user. The body of the loop contains a number of if statements The program displays a message when an illegal character is identified and specifies why it is illegal. Below are some examples of how a user would interact with the application, use this as a guide when designing the input and output of your application.

Recommended Answers

All 2 Replies

You need to demonstrate more effort on these questions that you are posting. Simply posting the assignment is not sufficient and no one is going to just complete these for you.

Post what code you have. Ask specific questions about concepts you are struggling with.

You need to demonstrate more effort
and read page 35 in your textbook
sorry if i didn't help you but just You need to demonstrate more effort
hope you solve it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.