Package (WRAP) Basic data type
Basic data types: Long, Int, double, float, Boolean, byte, etc. In Java, these are not objects, but pure data.
If you package the basic data type into an object, you can operate on this object as if you were using the basic data type as an object.
You can use the int, long, double, float, Boolean, byte, and other corresponding integer, long, double, float, Boolean, and byte classes for packaging and object operations.
Automatic packing and unpacking
The automatic packing function is provided after j2se 5.0. You can directly package the basic data type as follows:
Integer integer = 10;
Or:
Int I = 10;
Integer integer = I;
You can also use a more general java. Lang. Number class for automatic packing:
Number = 3.14f;
3.14f is automatically packed as float and then specified to number.
It can be automatically packed or split from j2se 5.0:
Integer Foo = 10;
int foof = Foo;