Conversion of small types to large types is done automatically, without the need for programmers to write extra code, which is the responsibility of the JVM.
PS: Automatic type conversion is also called an implicit type conversion.
Rules for automatic type conversion: symbol bits are automatically expanded, negative complement 1, positive complement 0
Automatic type conversion consists of the following:
1.byte->short->int->long->double->
Data of type 2.int and char can be converted to each other automatically in some cases
Do a test.
The int type is 32 bits, the highest bit is the sign bit, and the remaining 31 bits are the mantissa.
The long type is 64, the highest bit is the sign bit, and the remaining 63 bits are the mantissa. PS: mantissa: Precision value.
When the int type is converted to a long type, because it is a negative number, the sign bit complements 32 bits of 1.
Type conversions: small types to large type conversions