1. Java data types are divided into 2 categories
>> Native datatype (primitive data type)
>> reference data type (reference)
3. Constants and variables
Constant: The so-called constant is the amount of value that does not change;
Variable is the amount of value that can change.
4. How do I define and use variables?
int A; Declaration of variables
A = 10; Initialization of variables
int B = 20; Declaration and initialization of variables
Note: If no initialization results in the following:
The difference between = = and = in Java:
= Represents an assignment operation, assigning the value to the right of the equal sign to the left variable
= = equals
format:
The name of the variable's type variable = value;
5. There are 4 types of native data types 8
>> integer type int denotes an int representing 32-bit 2^32 (-2147483648-2147483647)
>> character type Byte represents a character type 8 bits (-128-127)
>> Short integer 16 bits (-32768-32767) 65535
>> Long Integer is 64 bits, he is the largest representation range for shaping
6. Literal and Direct volume
7. Java Each data type is a range, if you exceed this range, then will form a closed loop, such as your maximum value plus 1 So the result is the minimum value, the minimum value minus 1 results is the maximum value
8. In Java, an integer by default is of type int, and if you are assigning an int type to a byte type the system will think of losing precision and running out of compile error. If you have to assign a value like this, then you need to manually force the type conversion
JAVA 1.2 (Native datatype Primitive data type)