Primitive wrapper class in Java: Difference between revisions

Content deleted Content added
Line 28:
 
== Use of primitive wrappers in reflection ==
When looking for [[Method (computer science)|methods]] with a particular signature, each argument of the [[Method signature|method signature]] must be defined using its corresponding [[Class (computer science)|ClassesClass]] type. To be able to define primitive arguments, each primitive type is associated with an immutable [[Class (computer science)|Class]] that represent this type when using reflection.
 
Suppose a class ''Foo'' with one [[Method (computer science)|method]] called doSomething, with one primitive ''int'' parameter. If we want to call this method using reflection, we will have to use the Type associated with the ''int'' primitive: