Wht is the meanig of wrapper class. Everyone use this class but why?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Wht is the meanig of wrapper class. Everyone use this class but why??

25th Apr 2019, 8:19 AM
🇧🇩Muhammad iAR HOSSAIN🇧🇩
🇧🇩Muhammad iAR HOSSAIN🇧🇩 - avatar
4 Answers
+ 17
A Wrapper class is a class whose object contains a primitive data types. When we create an object to a wrapper class, it contains a field and in this field we can store a primitive data type. In other words, we can wrap a primitive value into a wrapper class object and perform some further operations on it. You can refer the below threads for more explanation. https://www.sololearn.com/discuss/606385/?ref=app https://www.sololearn.com/discuss/1190896/?ref=app https://www.sololearn.com/learn/432/?ref=app
25th Apr 2019, 8:33 AM
Nova
Nova - avatar
+ 7
There used to turn primitives types into objects.
25th Apr 2019, 8:28 AM
D_Stark
D_Stark - avatar
+ 6
sometimes we cant use primitive types when we need it because the parameter doesnt accept primitive types for example you want to use an arraylist for your integer but ArrayList<int> will cause an error, because we need a class. this is where we'll need a wrapper class ArrayList<Integer>
25th Apr 2019, 8:26 AM
Taste
Taste - avatar
+ 1
Thanks for all of you..
25th Apr 2019, 9:14 AM
🇧🇩Muhammad iAR HOSSAIN🇧🇩
🇧🇩Muhammad iAR HOSSAIN🇧🇩 - avatar