如何创建原始阵列的一类? [英] How to create a Class of primitive array?
本文介绍了如何创建原始阵列的一类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此问题源自:如何通过反射得到这个Method对象
?我试图做到以下几点:
类C1 =的Class.forName([Ljava.lang.Integer;); //工作正常
类C1 =的Class.forName([林特;); //不起作用,因为它的原始
解决办法? INT []。类
是唯一的解决办法?
解决方案
类C1 =的Class.forName([I);
请参阅 Class.getName()
了解详情。
This question is derived from: How to get this Method object via reflection?
I'm trying to do the following:
Class c1 = Class.forName("[Ljava.lang.Integer;"); // works fine
Class c1 = Class.forName("[Lint;"); // doesn't work, since it's primitive
What is the workaround? int[].class
is the only solution?
解决方案
Class c1 = Class.forName("[I");
See javadoc of Class.getName()
for details.
这篇关于如何创建原始阵列的一类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文