------<a href= "http://www.itheima.com" target= "blank" >java training, Android training, iOS training,. NET training </a>, look forward to communicating with you! -------
the data types in Java are divided into two large categories: the base data type and the reference data type.
The basic data types can be divided into four categories: integer data type, decimal data type, character type, Boolean type.
The integer data type is also divided into:byte,short,int(integer),long (length integer). The default is type int. If you do not assign a value, the default value is 0. (long is assigned by adding an L to the integer value ).
Decimal data types are divided into: float (floating-point) ,double (double-precision floating-point type). The default is type. If you do not assign a value, the default value is 0.0 f).
Character type ,javaunicode code. java '
the Boolean value in Java is boolean not bool, only two values are true and false, thedefault value is false andcannot participate in data type conversions.
Data type conversion rules:
1. Eight data types can be converted to each other in addition to the Boolean type
2. Automatic data type conversion: low-precision to high-precision automatic conversion, and in the operation is first converted to high-precision re-operation.
Long L_1 = 123;// Automatic data type conversion
3. forced type conversion: high-precision to low-precision non-forced type conversion will be error, but high precision to low precision conversion will lose precision, it is recommended not to do so.
float f_1 = (float) d_1;
4. Data accuracy from low to High:byte<short<int<long<float<double
5. If the integer does not exceed the range of byte, short ,char, You can assign this integer directly to byte, short,char
6. A variety of data types to do mixed operations, first converted into the largest capacity of the kind of the operation
The basic data types in Dark Horse programmer-java