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.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…