I know the "modified" file is being referenced because I get output "Inside modified module" but when referencing the constant variable it still is 100 instead of 200.
Although I can fix it by compiling with the CLASSPATH pointing to the modified file, my question is should it matter?
During compile time shouldn't it just verify that the variable exists or does it also store all constants BEFORE the application is even executed?
Post by:Jesper de Jong
Constants, such as the public static final int X in your example, are inlined at compile time.
That means that if you compile class A and class B, then you edit class A and you only re-compile class A (not class B), the old value will still be in class B. You'll need to recompile class B too to make it see the new value.
Post by:Tom Landry
Thanks for clarifying as that makes perfect sense.
This thread has been viewed 520 times.
All times above are in ranch (not your local) time.
The current ranch time is Dec 10, 2018 17:00:45.