getFields()和getDeclaredFields()

xiaoxiao2021-02-28  74

getFields()获得某个类的所有的公共(public)的字段,包括父类。

getDeclaredFields()获得某个类的所有申明的字段,即包括public、private和proteced, 但是不包括父类的申明字段。

同样类似的还有getConstructors()和getDeclaredConstructors(), getMethods()和getDeclaredMethods()。

转载请注明原文地址: https://www.6miu.com/read-30881.html

最新回复(0)