Last Updated: June 6, 2026
Reflection's two most common jobs are reading or writing a field whose name you only know at runtime, and calling a method whose signature you only resolve at runtime. This lesson covers the two APIs that do that work: Field.get/set and Method.invoke. The previous lesson covered how to discover the Field and Method objects in the first place. Now we use them.
The pattern is the same for both. You look up the Field or Method, optionally call setAccessible(true) to bypass access checks, then read or write or invoke. The interesting part is the corner cases: static members, final fields, primitives, exception unwrapping, and the cost of doing this on a hot path.