Wrapper class
In Java, a wrapper class provides a mechanism to convert primitive data types into objects and vice versa. Primitive data types like int , char , float , and boolean are not objects and cannot be used in contexts that require objects, such as Java Collections Framework (e.g., ArrayList , HashMap ) or with generics. Wrapper classes address this limitation by "wrapping" the primitive value within an object. Key aspects of wrapper classes in Java: Primitive to Object Conversion (Autoboxing): Wrapper classes allow you to convert a primitive value into an object of its corresponding wrapper class. For example, an int can be converted to an Integer object. Since J2SE 5.0, this conversion happens automatically through a feature called autoboxing. Java int primitiveInt = 10 ; Integer wrapperInt = primitiveInt; // Autoboxing: int to Integer object Object to Primitive Conversion (Unboxing): ...