One, variable
Variable is the amount that can be changed, and each value assigned will open up a new memory address.
1, first, the variable needs a declaration, for example: int A, the A can also be regarded as a label, it points to a memory address, the address is an int type of package, you can access a to access memory address, the principle of
2. Rules for declaring variables
Letters or underscores "_" Start with numbers available at the end and cannot be declared with a keyword
The format of the declaration is as follows:
where float a=15.5f, the reason behind the addition of an F, and the following long v=123456789123456l behind the reasons for adding an L is as follows:
First, there is a default data type in Java
Here A is a float type, but the system recognizes that the default 15.5 is a double type, so if you want him to become a float type, 15.5 to add an F (case does not matter), as long v=123456789123456l, the principle of the same, you need to pay attention to, int cannot store such a large number.
One, constant
Values that cannot be changed, each constant has only one memory address.
Constant modifier final
Are some of the differences when declaring constants and variables, each value assigned to a variable opens a new memory address. Each constant corresponds to only one memory address, and multiple identical constant memory addresses have only one.
Iii. type Conversion
1), Automatic type conversion
Automatic type conversion is equal to conversion, or small to large conversion of a class
2), forced type conversion
Forcing type conversions is large to small conversions, and the system does not mind turning, but requires permission.
For example:
When the data type is converted, it is determined whether the corresponding data type can accept the number of bits of this data type, and the second binary is needed to determine the judgment.
Variables and constants, type conversions for Java basics