Method methodP=clazz.getMethod("printInfo", new Class[]{});
//methodP.invoke(obj, null); 这样会出现警告
methodP.invoke(obj, new Object[]{});
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
复制代码
用反射拿到成员方法和使用成员方法时,参数列表为null怎么会报这个警告:The argument of type null should explicitly be cast to Object[] for the invocation of the varargs method invoke(Object, Object...) from type Method. It could alternatively be cast to Object for a varargs invocation 作者: aurora_bessie 时间: 2015-7-22 09:28
lihua
234
name=lihua id=234
------------------------------------
一点没改,完全粘贴复制的你的代码。。。。作者: a12366456 时间: 2015-7-22 10:06