The code of the javascript is this:
var Player = {name: "Player", health: 100};
function getValue(propName){ //propName is a string.
return player[propName];
}
How would I implement this in Java by using classes rather than creating an object?
like I have some java code that looks like this:
public class Player(){
public String name = "Player"
public int health = 100;
}
and in another class, I would like to access those values by using strings like in javascript, so by doing Player["health"]