what is wrapper calss .where can we use wrapper class in java.give me one example?

Recommended Answers

All 2 Replies

a Wrapper class is a class that 'Wraps' a primitive datatype in a (sort-of) equivalent Object type.

for instance:
primitive int -> Wrapperclass Integer.

each primitive type has a Wrapper class that allows the user to treat variables of primitive types (or at least, their Wrapped versions) as objects.

where you can use it? everywhere, I guess. but if you want to compare using equals, or you want to store the a value of a primitive variable in a list (since they only allow objects).

when looking into Wrapper classes and what they are, I recommend you to also have a look at autoboxing/unboxing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.