Since Java 5, we\'ve had boxing/unboxing of primitive types so that int
is wrapped to be java.lang.Integer
, and so and and so forth.
I see
You should ask why Class/Object type is required
Reason for having Object type is to make our life easier when we deal with Collections. Primitives cannot be added directly to List/Map rather you need to write a wrapper class. Readymade Integer kind of Classes helps you here plus it has many utility methods like Integer.pareseInt(str)