Why do we have classes corresponding to primitive data types and what's their use? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why do we have classes corresponding to primitive data types and what's their use?

We have Integer class for int, etc

23rd Jun 2016, 3:25 PM
satish sahu
satish sahu - avatar
3 Answers
+ 2
they are wrapper to primitives. and ofcourse justify as object. and provies certain behaviors over primitive values.
23rd Jun 2016, 7:05 PM
neel
neel - avatar
0
to "wrap"
24th Jun 2016, 11:01 AM
yassine
yassine - avatar
0
The concept of objects and why they are useful is that they have state and behaviour. Since "int" in itself doesn't provide any behaviour, the Integer class was made to implement certain behaviours and apply the concept of OOP. I hope I was clear. :)
24th Jun 2016, 1:05 PM
Beardman13