In my code I need to use some constant values, so I created a utility class
public class ConstantUtility {
public final static String category1_name1="category1/name1";
public final static String category1_name2="category1/name2";
public final static String category1_name3="category1/name3";
.
.
.
public final static String category2_name100="category2/name100";
public final static String category2_name101="category2/name101";
.
.
.
}
But I have 2000 constant values. I do not use all these values in my application, but they should be there as a choice. The problem is that when I use the utility class, all variables are static variables and all string values are loaded into jvm.
Constants 2000 are divided into 6 categories. I tried using 6 static classes, but still remained the same. When jvm finds a static class, it loads each static variable into memory.
Comparison with the constant memory of a string, which I really use for all those constants that I don't use, loads a lot more in jvm.
: .