It's easy to get a class literal for a class:
String.class
But how can I get a class object for an array type?
This works, but it's ugly, and probably not a compile time constant:
new byte[0].getClass()
I looked in the JLS but the only thing I found out is that what I'm calling a "class literal" isn't a "literal" according to the JLS definition.
Aucun commentaire:
Enregistrer un commentaire