I have an example class:
public class A {
public int x;
}
If I were to do something like the following:
Class a = Class.forName("A");
for (Field f : a.getFields()) {
System.out.println(f);
}
I would get this as output:
public int A.x
But what I really want is this:
public int x
I’ve looked through the Class and Field APIs but there doesn’t seem to be a method for this. Is there a way of doing this?
Thanks.
Use,