A primitive data type has no methods or properties. to enable the use of methods on primitives, a mechanism called auto boxing comes into play.
Auto boxing involves automatically converting primitive data types like
boolean into their respective wrapper objects (
Boolean) when an object-specific property or method is accessed on them. This allows primitives to temporarily behave like objects with access to additional functionality.
Here’s an example to illustrate auto boxing:
The boxed type
Number can be also expressed as: