What's the difference between static and non-static enum in Java? Both usages are same.
Is it correct that all static ones are loaded on memory on startup, and non-static ones are loaded on demand?
If yes, then which method is better? Keeping some data always in memory or using server resources to load them each time?
public class Test {
public enum Enum1 {
A, B
}
public static enum Enum2 {
C, D
}
public static void main(String[] args) {
Enum1 a = Enum1.A;
Enum1 b = Enum1.B;
Enum2 c = Enum2.C;
Enum2 d = Enum2.D;
}
}