Engineering With Java

Engineering With Java

Java Interview Question - Can You Modify a Final Field using Reflection?

Reflection, Concept, Coding and more ...

Suraj Mishra's avatar
Suraj Mishra
Jan 16, 2026
βˆ™ Paid

Yes, it is sometimes possible to modify a final field using reflection, but not always, and even when it works, it is unreliable, JVM-dependent, and absolutely discouraged in real systems. Also, there is work in JDK 26 to remove this in the long term.

When can it work?

But first, when we talk about the final, there are three main scenarios:
1. Non-static final fields - tied to object instance
2. Static final compile-time constants - primitive or String literals that the compiler inlines
3. Static final non-constant references - objects or boxed types initialized at runtime

Each behaves differently when reflection comes into play.


πŸ“’ πŸ“’ πŸ“’ Get actionable Java insights every week β€” from practical code tips to expert interview questions you can use today.

Join 3500+ subscribers and level up your Spring & backend skills with hand-crafted content β€” no fluff.

I want to offer an additional 40% discount ($ 18 per year) until January 31st.

Subscribe now

Not convinced? Check out the details of the past work


1.Non-static final fields β€” technically mutable

Surprisingly, Java allows reflective modification of non-static final fields in many versions, including Java 25:

This works for instance fields, because they aren’t compile-time constants.

User's avatar

Continue reading this post for free, courtesy of Suraj Mishra.

Or purchase a paid subscription.
Β© 2026 Suraj Mishra Β· Privacy βˆ™ Terms βˆ™ Collection notice
Start your SubstackGet the app
Substack is the home for great culture