==========
Step 1
==========
File A.java public static final int X = 100;
File B.java - makes reference to A.X
These two files are stored in App1.jar
==========
Step 2
==========
The above 2 files (File A.java & B.java are copied to a new location)
File A.java is modifed to change X
public static final int X = 200; (200 instead of 100)
It also includes println commands.
System.out.println("Inside modified module");
File B.java - makes reference to A.X
Note: during compile time the CLASSPATH is still set to reference the original A.java.
These two files are stored in App2.jar
==========
Step 3
==========
Run the application using App2.jar
java -classpath /usr/bin/App2.jar .....
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.
============
Question
============
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?