Identifier definition
Definition of identifiers: The sequence of characters used to name features such as various variables, methods, and classes becomes an identifier.
Simply put, the name of the place where you can call the identifier, the rules of the identifier must abide by.
Naming rules
- Identifiers can only consist of letters, underscores "_", Dollar Signs "$", or numbers
- Identifiers can only start with a letter, underscore, or dollar symbol
- Identifiers cannot be Java keywords and reserved words
- Identifier case sensitive, unlimited length
Conventional
In order for Java code to be better maintained and aesthetically pleasing, it is common to write Java code that follows some established rules:
- Identifiers may be made up of a number of words or abbreviations, but the name cannot be too long
- When a word consists of multiple words, the first letter is lowercase, and the other words are capitalized in a mixed case, such as: UserName.
- Class name capitalized, other (variable name, method name, etc.) First letter lowercase
Key words
Keywords are strings in Java that are assigned specific meanings and are used for specialized purposes. All Java keywords are in lowercase english.
Goto and const, although never used, are also reserved as Java keywords
All keywords are as follows:
| Abstract |
Assert |
Boolean |
Break |
Byte |
| Case |
Catch |
Char |
Class |
Const |
| Continue |
Default |
Do |
Double |
Else |
| Enum |
Extends |
Final |
Finally |
Float |
| For |
Goto |
If |
Implements |
Import |
| instanceof |
Int |
Interface |
Long |
Native |
| New |
Package |
Private |
Protected |
Public |
| Return |
Strictfp |
Short |
Static |
Super |
| Switch |
Synchronized |
This |
Throw |
Throws |
| Transient |
Try |
void |
Volatile |
While
|
Java Learning Note Two--identifiers and keywords