I have a variable that contains the name of another variable. I intend to read the contents of the variable name. how?

Recommended Answers

All 4 Replies

So is your setup like this:

String variableName = "aVariable";
int aVariable = 670;

And you want to access aVariable through variableName? If that's the case, why do you need variableName?

And you want to access aVariable through variableName? If that's the case, why do you need variableName?

Yes. Because aVariable derived from the results of an operation of reading the contents of the field from a class.

getClass().getFields();

tank you......

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.