Basic data type:
First, the numerical type
1) Integer:
1, byte byte, 8 bit, value range 0~255, for storing binary data.
2, short two bytes, 16 bits, the value range is between -32768~32767.
3, int four bytes, 32 bits, the value range is between -2147483648~2147483648
4, long eight bytes, 64 bits, with a value range of-9,223,372,036,854,775,808 ~9,223,372,036,854,775,807
2) Floating-point type:
1, float, four bytes, single-precision floating-point number, range of -2^128
~ +2^128
2, double, eight-byte double-precision floating-point number, range is -2^1024
~ +2^1024
Character type: Char, a set of data
Three, Boolean: Boolean, only two values, one true, one false
Four, Strings: string,
Basic Data type conversions:
Low-level to advanced can be automatically converted
Char→int→long→float→double
Byte→short→int
Forced conversions
Double num1=78.2;
int num2= (double) num1
The above basic data type of Java Foundation is a comprehensive analysis of the small series to share all the content, I hope to give you a reference, but also hope that we support the cloud habitat community.