Java data types are divided into built-in types and extension types, where the built-in type is the base data type, and the extension type is the other type (also called the reference type) that the Java language extends out of the base type (for example, class,string, and so on). This paper mainly discusses the former.
Boolean: Can only fetch two values: True and false, used to determine whether;
Byte,short,int,long: All represent integer types, but the respective range of values is different from the size of the occupied space, and the larger the range, the greater the space occupied. Generally used int type, but if the memory consumption requirements are relatively strict, you should carefully choose which type to use;
float and double: denotes floating-point type, that is, decimal, value range and occupy space with the same integer type, occupy more space, decimal precision is higher;
Type conversions:
In programming, sometimes we need to convert one type to another, and this process is called type conversion. The transition from a type with a low precision to a type with high precision can be directly converted, for example:
int a = 10;
Long B = A;
Going from a type with a high precision to a type with a low precision requires coercion of type conversions, like this:
Long T = 7878787;
int b = (int) T;
Finish.
Java Basic Road (i)