Basic data types:
1. Numerical
1) Integer:
1. Byte one byte, 8 bits, with a value range of 0~255, used to store binary data.
2. Short two bytes, 16 bits, the value range is between -32768 and 32767.
3. Int has four bytes, 32 bits, the value range is between -2147483648~2147483648
4. Long eight bytes, 64 bits, the value range is -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 is -2^128
~ +2^128
2. Double, eight byte double precision floating point number, range is -2^1024
~ +2^1024
2. Character type: char, a collection of data
3. Boolean: boolean, only two values, one true, and one false
4. String: String,
Basic data type conversion:
Low-level to advanced can be automatically converted
char→int→long→float→double
byte→short→int
Cases
double num1=78.2;
int num2=(double)num1
The above comprehensive analysis of basic data types of JAVA basics is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.