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

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

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

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

 

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

posted @ 2020-03-04 14:02  warrior1234  阅读(2171)  评论(0编辑  收藏  举报