Java SE Basics: Identity (zhì) selector, identifier definition
Identifiers are sequences of characters that give names to classes, interfaces, methods, variables, etc.
Ii. composition rules and matters needing attention 1. Composition rules
- English uppercase and lowercase letters
- Array
- $ and _
2. Precautions
- Cannot start with an array
- cannot be a Java keyword (see keyword table:)
- Case-sensitive when writing (uppercase and lowercase represent two different identifiers, such as public and public are different)
Third, the naming rules of the identifiers in Java to do: see the name of the idea
- Package: A package is actually a folder that distinguishes the structure of a file in a project, and the package name should use lowercase
- Single-level package: Todo
- Multi-level package: Com.rishiqing.todo
- Classes (Class) and Interfaces (interface)
- Name a word: The first letter of the word must be capitalized, for example: Student,dog,person, etc.
- Name multiple words: Each word must be capitalized (named with the Hump), for example: Helloworld,kanbanexportcsv, etc.
- method or variable (variate)
- A word named: The first letter lowercase, for example: Name,age, etc.
- Multiple words named: The first letter lowercase, then the first letter of the concatenation of the words to capitalize (using the Hump method named), such as: username,password,departmentnamelist, etc.
- Constants (constant)
- A word named: all uppercase, for example: PI = 3.1415926,e = 2.71828, etc.
- Multiple words named: All uppercase, between words and words using "_" to connect, for example: Millis_5_min,student_name, etc.
Java SE Basics: Identity (zhì) character