int cadence = 0; int speed = 0; int gear = 1;
The Java programming language defines the following kinds of variables:
- Instance variables (non-static fields) – are unique to each instance of a class.
- Class variables (static fields) – are fields declared with the static modifier; there is exactly one copy of a class variable, regardless of how many times the class has been instantiated.
- Local variables – store temporary state inside a method.
- Parameters – are variables that provide extra information to a method; both local variables and parameters are always classified as “variables” (not “fields”).
- Variable names are case-sensitive A variable’s name can be any legal identifier — an unlimited-length sequence of Unicode letters and digits, beginning with a letter, the dollar sign “$”, or the underscore character “_”.
- Subsequent characters may be letters, digits, dollar signs, or underscore characters.
- If the name you choose consists of only one word, spell that word in all lowercase letters. If it consists of more than one word, capitalize the first letter of each subsequent word.