As a programming language, Java, like other languages, has the basic elements of character sets, identifiers, and keywords, variables, constants, statements, and other programming languages.
1. Key words
| Abstract |
Boolean |
Break |
Byte |
Case |
| Catch |
Char |
Class |
Const |
Continue |
| Default |
Do |
Double |
Else |
Extends |
| Assert |
Final |
Finally |
Float |
For |
| Goto |
If |
Implements |
Import |
instanceof |
| Int |
Interface |
Long |
Native |
New |
| Strictfp |
Package |
Private |
Protectde |
Public |
| Return |
Short |
Static |
Super |
Switch |
| Synchronized |
This |
Throw |
Shrows |
Transient |
| Try |
void |
Volatile |
While |
|
In these keywords conse and goto cannot be used in Java, they are simply used when converting C and C + + to Java code. In addition Java has three reserved words, true, false, null these three reserved words are literal values, and not the key is. However, they cannot be used as identifiers and have specific meanings for Java programming.
2. Identifiers
in Java, we need to identify many elements of the code, including the class name, method, field, variable, package name, and so on. The name we choose is called an identifier, and the following rules are followed:
(1) Identifiers cannot be keywords or true, false, or null.
(2) identifiers can contain letters, numbers 0-9 underscores (_), or dollar signs ($).
(3) The first character of an identifier must be a letter, an underscore (_), or a dollar sign ($).
(4) Identifiers are case-sensitive and do not specify a maximum length.
Keywords and identifiers for Java