I'm trying to set variables from a text file. If the string I get is exactly the same name as a variable in my class, can I set it directly? For example:
int myValue;
String s = "myValue";
int i = Integer.parseInt("42");
Is there a better way to assign the value besides doing:
if (s.equals("myValue"))
myValue = i;
