What is an identifier
is when programmers define Java programs, some of the names that are customized. Identifiers can be applied to class names, variables, function names, and package names.
Identifiers must follow the following rules
- Identifiers are composed of 26 English character case (a~za~z), Number (0~9), underscore (_), and dollar sign ($).
- Cannot start with a number, cannot be a keyword
- Strictly case-sensitive
- The identifier can be any length
The identifier naming specification in Java is
1.
Package Name
All letters lowercase When multiple words are composed (example: Package Com.baidu)
2. class name and interface
Capitalize the first letter of all words when multiple words are composed (example: HelloWorld)
3. variable name and function name
When multiple words are composed, the first letter is lowercase, the other words are capitalized (example: LastAccessTime, GetTime).
4. constant Name
When multiple words are composed, the letters are all capitalized, and multiple words are separated by _ (example: Integer_cache)
Note : Just to increase the normative, readability of a convention, the identifier in the definition of the best to see the name of understanding, improve code reading.
Java Learning Note II Java Identifier naming specification