Reputation: 2748
int.class returns an object of class type.
although there is a method to invoke constructor of a class, but since int.class represents primitive data type so no constructor are available.
Is there any way to create an int variable from int.class object ??
Upvotes: 2
Views: 181
Reputation: 533442
You cannot create an instance of a primitive. Primitives are not Objects by definition. You can create an instance of a wrapper e.g. Integer
which has a constructor which takes an int
Upvotes: 2