I was wondering whether it would be possible to have something like the following in Java:
public class MyClass { private String name; private Intege
Though I'm at a loss as to why you would want to do it like that (since you already have getters and setters), try this:
Field aField = getClass().getDeclaredField(aFieldName); aField.set(this, aValue);
For more info, see this.