JAVA反射中的getFields()方法和getDeclaredFields ()方法的区别

Posted 格物致知

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JAVA反射中的getFields()方法和getDeclaredFields ()方法的区别相关的知识,希望对你有一定的参考价值。

getFields:获取所有公共的public修饰的方法,包括父类的方法

getDeclaredFields:获取所有本类声明的方法,包括private修饰的,但是不包含父类的方法。

类似的还有 getMethods 与 getDecalredMethods, getConstructors()和getDeclaredConstructors();

 

https://www.cnblogs.com/JackZed/p/6888668.html

以上是关于JAVA反射中的getFields()方法和getDeclaredFields ()方法的区别的主要内容,如果未能解决你的问题,请参考以下文章