且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

反射时Java参数类型不匹配

更新时间:2023-11-30 21:19:16

您忘记将参数传递给方法调用.

You forgot to pass an argument to your method invocation.

return (int) method.invoke(this.cls.newInstance(), myArrayList);

您也可以使用空参数调用:

You can also invoke with a null argument:

return (int) method.invoke(this.cls.newInstance(), (Object[])null);