Suppose I have a String Variable like this in Java:
String cat = "felix";
int felix = 6;
Is there some way in Java that I could compare the contents of cat - "felix" to the name of the int variable felix?
Suppose I have a String Variable like this in Java:
String cat = "felix";
int felix = 6;
Is there some way in Java that I could compare the contents of cat - "felix" to the name of the int variable felix?
There is no way to do it with the method you are doing, but you can use hashmap: