Skip to main content
The 2024 Developer Survey results are live! See the results
2 events
when toggle format what by license comment
Feb 9, 2023 at 8:11 comment added Holger “Based on Irkwz's answer” and similarly pointless. You are not checking the values of the fields but only if the array of Field instances returned by getDeclaredFields() contains null, which is always false. You’d have to actually get() the field’s value before checking. And when accessing private fields, you should use SomeClass.class instead of getClass(), because getClass() may return a subclass.
Oct 12, 2021 at 13:02 history answered HowToTellAChild CC BY-SA 4.0