I understand the class literals and the getClass()
methods how they help with generics and reflection but I don't understand why the same would apply for primitives as well?
For example, for int, I can use int.class
but not sure what you could do with it.
- You cannot instantiate via
int.class.newInstance()
, it will throw anException
- You cannot use them with generics since those require non-primitives
Any ideas?
Aucun commentaire:
Enregistrer un commentaire