Suppose there is a class :
class A {
int a;
}
And then there is a child of class A :
class B extends A {
int b;
}
if i call B.class.getDeclaredFields()
i'll only get 'b' field.
Now how can i get fields of parent class in this case 'a'.
Suppose there is a class :
class A {
int a;
}
And then there is a child of class A :
class B extends A {
int b;
}
if i call B.class.getDeclaredFields()
i'll only get 'b' field.
Now how can i get fields of parent class in this case 'a'.
You should call it with something like this:
B.class.getSuperclass().getDeclaredFields();