Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

What means wrapper?

I can't understand what wrapper means? I made casting from String to int but, now I'm confused with wrapper, what does it means?

1 Answer

Hello Giorgi Kiknadze,

A wrapper is just a class that can add extra functionality to a primitive type.

The primitive types in java are

byte, short, int, long, float, double, boolean, and char.

It is easy to tell if a type is primitive because it starts with a lower case letter.

The Wrappers for these primitives are as follows

Byte, Short, Integer, Long, Float, Double, Boolean, Character

Wrapper classes can be used to store the same value as of a primitive type variable but the instances/objects of wrapper classes themselves are Non-Primitive.

Hope this helps!

Thanks, it's a great answer.