反射错误汇总

来源:互联网 发布:linux磁盘挂载 编辑:程序博客网 时间:2024/04/28 21:30

1、can not access a member of class com.test.C with modifiers "public"

出现这种错误是因为类的访问权限不是public,把访问权限改为public即可。

2.can not access a member of class com.test.C with modifiers "private"

如果方法的访问权限为private,反射时需要调用setAccessible(true);这个方法。

0 0
原创粉丝点击