Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
carFields[1].getClass() is going to represent a Field object. You want carFields[1].getType().getFieldsgetDeclaredFields().
carFields[1].getClass()
Field
carFields[1].getType().getFieldsgetDeclaredFields()
Also, as BalusC commented, be careful. The fields aren't necessarily in the order you expect.
carFields[1].getClass() is going to represent a Field object. You want carFields[1].getType().getFields().
carFields[1].getType().getFields()
carFields[1].getClass() is going to represent a Field object. You want carFields[1].getType().getDeclaredFields().
carFields[1].getType().getDeclaredFields()