What is the difference between these two? A primitive type cannot have "Class", can it - it is primitive. There are no objects to have a class.
Where does these two make a difference?
What is the difference between these two? A primitive type cannot have "Class", can it - it is primitive. There are no objects to have a class.
Where does these two make a difference?
I'm not positive what you mean, but -- A Class
object is a runtime representative of a type. That said, there is such a thing as int.class
that is distinct from Integer.class
, even though int
is not a class. It's kind of complicated, but it's necessary to make reflection work even on methods that take primitive arguments or return primitive values, or to distinguish a method that accepts an Integer
from a method that accepts an int
.
Integer.TYPE
, I believe, is equivalent to int.class
.