I have two Java projects: one is a library, and the other is a console application. In the library project, I have an abstract class with a few static member variables (for global access). It looks a bit like this:
public abstract class AbstractHelper
{
public static final VarType someVar = new VarType();
}
I access the static member variables from the console application in two different classes.
For some reason, 'someVar' has unique instances across the two different classes that access it. If I access 'someVar' from an instance of Class A, I get a different object than when I access 'someVar' from an instance of Class B.
However, if I move AbstractHelper from the library project into my console application project, then it has the expected behavior (single instance of static member variable(s) shared across multiple classes)
Does anyone know why this happens?