Abstract
- Make Primitive Datatype to be in a subtyping relationship with the object class to fit into the OOP concept
- Has built-in method to convert current value to other Primitive Datatype or custom datatypes primitive, known as Boxing
Important
Custom datatype objects are immutable (a new object is created when a new value is assigned).
Resource Demanding
Comes with cost of allocating Heap Segment for OOP Object & collecting garbage afterward. Thus, less efficient than Primitive Datatype
Double d = 4results in compilation error
int cannot be converted to Double, butdouble d = 4works because it is a Widening Type Conversion.
Double d = 4.0also works because it is Auto-boxing.
Object o = 4;works because4will be first auto-boxed to anInteger, andIntegeris a subtype ofObject.
Attention
All the wrapper classes are not in a subtyping relationship that is found with the primitive datatypes, and you canβt inherits from any wrapper classes!

Comes with cost of allocating