I just asked myself a little question, and I'm not sure if I can find the right answer to this question:
If I use ENUM in Java, with my own constructor (and many, many maaaaany parameters), are those stored in memory every time the program is executed, or are they only βloadedβ into memory if they are used?
What do I mean if I have an ENUM with 400 entries and only one of the entries is used - are they still present in memory?
some pseudo code:
public enum Type { ENTRY_A(val1, val2, val3, val4, new Object(val5, val6, val7, ...)), ENTRY_B(val1, val2, val3, val4, new Object(val5, val6, val7, ...)), ENTRY_C(val1, val2, val3, val4, new Object(val5, val6, val7, ...)), ... }
If I use only ENTRY_A and do not touch ENTRY_B, ENTRY_C, etc. - how will Java handle just that?
Thanks for the answer - and yes, it's basically curiosity