Wrapper Class in Java
A Wrapper class in Java is a class that wraps or encloses a primitive data type and converts it into an object. The Wrapper classes are used to convert primitive data types into objects, which are necessary when the data type is to be used in a method that requires an object.
The Wrapper classes in Java are
- Boolean
- Byte
- Character
- Double
- Float
- Integer
- Long
- Short
These classes provide methods to convert the primitive data type into an object and vice versa. For example, the Integer class provides the parseInt() method to convert a string representation of an integer into an integer object.
Comments
Post a Comment
If you have any doubts, Please let me know