Identifiers are names that give classes, interfaces, methods, and variables, and represent references to memory space.
Identifiers consist of numbers, letters, _, $, but cannot begin with a number. Because Java is encoded in Unicode, it contains the alphabet (including Chinese) for most countries.
Naming conventions:
Project name, class name: First letter capital.
Package name: All lowercase.
Method name, variable name: In the case of a hump, when the identifier contains various meanings, the first letter of the English word is lowercase, the remaining words are capitalized, such as: Studentname, Teacherno.
Constant name: all caps.
There are eight basic types of data:
Integer class: Byte 1 byte
Short 2 bytes
int 4 bytes
Long 8 bytes
Logical class: Boolean 1 bytes
Floating-point type: Float 4 bytes
Double 8 bytes
Character type: Char 2 bytes
When a basic data type is created and given to a variable, the data is created in a constant pool of memory, which is not modified, and the variable references the data of a constant pool when the variable is assigned again. Therefore, when basic data is passed as a parameter, modifying the data of the formal parameter does not affect the argument.
However, string objects are special, string objects reference string data in a constant pool. When a string object is created, it first creates string data in a constant pool (the string data is a reference to char in a constant pool), and then creates a string object and references string data, so if you create multiple string objects of the same string, Their hashcode are all the same. If you reassign a variable of type string, you actually refer to a new string object, and the data for the original object does not change. There is also no way to change the current object data in the String class.