Interview question. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Interview question.

What are Wrapper Classes and String classes?

4th Nov 2016, 6:29 PM
Jenny Lance
Jenny Lance - avatar
2 Answers
+ 2
Wrapper classes
4th Nov 2016, 6:30 PM
Jenny Lance
Jenny Lance - avatar
+ 2
In java there are primitives(int double...) and objects(String Point...). If you need an int but as an object (eg. in a ArrayList which is generic so you need to specify the type and therefore its content has to be some kind of object) you need to wrap them. for each primitive there is a wrapper class so basically an object representation. usually you do not need to do this explicitly as java has a feature called auto boxing which wraps the primitives into objects and vice versa if needed
4th Nov 2016, 9:42 PM
No One
No One - avatar