I would like to get a variable's value by having variable's name, how can I achieve it ?
private String firstName = "myFName";
private String secondName = "mySName";
public void print(String fName , String sName){ // fName = "firstName" , sName = "secondName"
//print fName value which is actually "myFName"
//print sName value which is actually "mySName"
}
Thanks
Aucun commentaire:
Enregistrer un commentaire