I understand
Is there any way/scenario that I can have two copies of my static with different values ?
Yes, you can have this case for static final
primitives.
Let's consider the following case:
public static final int SOME_CONSTANT = 1
A.SOME_CONSTANT
public static final int SOME_CONSTANT = 2
If you were to now start a JVM (with A and B on the classpath), the value of the static will be 1 in class A whereas class B will have a value of 2. This is because javac
compiles a copy of the value into each .class file. Class B has it's own copy of the static and does not reference class A. To fix this, you MUST recompile class A every time the constant changes in class B (ie do a clean build instead of an incremental build). Note, this problem is only for static final
primitives (int, long etc).