Let's first look at the general meaning of "syntax" here...
The syntax (rules) for coding variables are pretty straightforward as shown below.
- First declare the data type for the variable
- Declare the variable name. This is "coder's choice" but should follow the naming guidelines from this chapter.
NOTES --
- Java is picky (including case). E.g. Java considers these different variables: "firstName" and "FirstName".
- You do not want a single quote ' or double quote " anywhere in the variable declaration. You may run into text like: The variable data type is "String" and name is "firstName". You would code it as firstName (without the quotes).