0
Method method;
try {
method = m.getClass().getMethod(h);
} catch (SecurityException e) {
} catch (NoSuchMethodException e) {
}
try {
//line below wants me to initialize it
method.invoke(m);
} catch (IllegalArgumentException e) {
} catch (IllegalAccessException e) {
} catch (InvocationTargetException e) {
}
此代码位于while循环中。当我将Method方法设置为null时,我得到一个空点异常。我如何让我的代码在我的while循环中运行。如何在不初始化的情况下在while循环中进行反射