I defined a class (as a substitute to macros in c)
public class Constants {
public static final int i1 = 1;
public static final int i2 = 2;
}
And another "global variable" class
public class GlobalVars {
public static Integer gi1;
public static Integer gi2;
}
I assign like this:
GlobalsVars.gi1 = Constants.i1;
While I do not get any compiler warning and it works in 1000 test cases, is it possible that this causes GlobalVars.gi1 to become null in special cases - like on certain Android devices running various versions?
EDIT:
I compare like this:
if (GlobalVars.gi1 == Constants.i1)
and this is where the NullPointerException error occured