I'm developing an app in Android. I use a lot "final static"
variables to define my constants. But I'm very stric with the memory used by my application.
Maybe I have 200 constants (int, string, double, ...). It is much better to program with constant variables that use numbers. But, how efficient is this?
Using C I can use #define
, and when I put:
#define constant 10
int var2 = constant;
int var3 = constant;
The compiler translates the code to:
int var2 = 10;
int var3 = 10;
But using Java, I think that all these variables stay in memory. There is something so efficient as #define
for java?