I have this class in Java in which I declared a large number of variables (more than 50) as:
public static final String variable_1 = "value";
....
I would like to access all these variables and put them in a list from within another class. Is there any way of doing that by using a for loop?
You can use reflection API, like this:
As others said, though, this is pretty ugly and probably indicates some bad design decisions.