。 underlying data type
|
Data type |
Classification |
Number of binary digits |
Wrapper class |
|
Byte |
Numeric type |
8 |
Byte |
|
Short |
Numeric type |
16 |
Character |
|
Int |
Numeric type |
32 |
Integer |
|
Long |
Numeric type |
64 |
Long |
|
Float |
Numeric type |
32 |
Float |
|
Double |
Numeric type |
64 |
Double |
|
Boolean |
|
1 |
Boolean |
|
Char |
String |
16 |
Character |
。 Reference Data Type
Java has 5 reference types (object types): Class interface Array enumeration callouts.
Data type conversion Description:
Underlying data type:
Conversions from strongly typed to weakly typed require casting, and the system automatically transforms from weakly typed to strongly typed conversions. For example, if thedouble type is strongly typed compared to the int type, then the data converted from the double type to the int type will need to be cast , whereas the other is automatically converted. The strength and weakness of the other eight basic data types are as follows:byte<short=char<int<long<float<double, conversion between peers also requires casting
Reference data type:
When a subclass object is converted to a parent class object (including an interface) in a class, the system is automatically converted, called upward transformation, and when the parent class object (including the interface) is converted to the subclass object, a cast is required, called a down-casting.
Java Data types