Home >Java >javaTutorial >Introduction to java data types
Numeric type
Integer type (byte, short, int, long )
Character type (char)
Boolean type (boolean)
Class
Interface
Array
Note: For example, the String type is also a class type.
1. Conceptually
Basic type: variable name points to a specific value
Reference type: variable name points to the memory address of the data object
2. From the perspective of memory construction
Basic type: Java will allocate memory space to the variable immediately after it is declared
Reference type: No memory is allocated when the variable is declared, but a memory address is stored
3. From the aspect of use
Basic type: When using, you need to assign a specific value, and when judging, use the "==" sign
Reference type: When using, you can assign null. When judging, use the equals method
Data type | byte |
---|---|
long | 8 |
int | 4 |
2 | |
1 | |
2 | |
1 | |
4 | |
8 |
NoteThe char type in java is stored in Unicode encoding. Can store Chinese characters.
The above is the detailed content of Introduction to java data types. For more information, please follow other related articles on the PHP Chinese website!