1. Identifiers
Used to name variables, classes, and methods. Attention:
The identifier that represents the class name begins with an uppercase letter. such as:man, GoodMan
the identifiers that represent methods and variables begin with lowercase letters, and the following descriptive words begin with uppercase. Green(),greencard ()
The Java identifiers have the following naming conventions:
<1> identifiers must begin with a letter, underscore _ , dollar symbol $
<2> The other part of the identifier can be a letter, an underscore "_", a dollar symbol "$" , and any combination of numbers
<3> Java identifiers are case sensitive and have unlimited length
<4> it can't be . keywords for Java
Valid identifiers:
int a = 3;
int _123 = 3;
int $12AA = 3;
int variable 1 = 55;
An illegal identifier:
int 1a = 3; Cannot start with a number
int a# = 3; Cannot contain special characters such as #
int int = 3; Cannot use keywords
JAVA does not use the ASCII character set used in the usual language , but rather a Standard international character set such as Unicode.
2. Character Set
Keywords / reserved words in 3.JAVA
The Java keyword is reserved for internal use by the Java language , such as class for defining classes. Keywords can also be called reserved words , they mean the same
Abstract |
Assert |
Boolean |
Break |
Byte |
Case |
Catch |
char (character) |
Class |
Const |
Continue |
Default |
Do |
Double |
Else |
Extends |
Final |
Finally |
Float |
For |
Goto |
If |
Implements |
Import |
instanceof |
Int |
Interface |
Long |
Native |
New |
Null |
Package |
Private |
Protected |
Public |
Return |
Short |
Static |
Strictfp |
Super |
Switch |
Synchronized |
This |
Throw |
Throws |
Transient |
Try |
void |
Volatile |
While |
|
|
|
|
Note: You cannot use a keyword as a variable name or a method name
"Java" java_05 identifiers and character sets