China Naming Network - Ziwei Dou Shu - What are the rules of identifier definition in Java?

What are the rules of identifier definition in Java?

Rules of identifier definition in Java:

1, class and interface name. The first letter of each word is capitalized, including case. Such as MyClass, HelloWorld, Time, etc.

2. Method name. The first character is lowercase, and the rest of the first letters are uppercase, including case. Use as few underscores as possible. Such as my name, setting time, etc. This naming method is called hump naming.

3. Constant name. Constant names of basic data types are all in uppercase letters, and words are separated by underscores. Object constants can be mixed case. For example, SIZE_NAME.

4. Variable name. Case can be mixed, the first character is lowercase, and the word separator is capitalized with the first letter of the word. Don't underline and use less dollar symbols. Naming a variable is an attempt to know its meaning by its name.

Extended data:

Identifier specified in java language:

It consists of uppercase and lowercase letters, numbers, underscores and dollar symbols, but it cannot start with a number. Identifiers cannot use keywords in java.

References:

Baidu encyclopedia -java identifier