I was wondering, if it's possible to call a variable of other class by passing value to object from another variable.
Something like this:
class Foo {
public String classVar = "hello";
}
then we make a object of the class :
Foo bin = new Foo();
Now, I know we can use var by :
bin.classVar;
But, suppose value classVar
is in another string variable :
Foo bin = new Foo();
String var2 = "classVar";
bin.var2 ??????????
How to achieve this?