日期:2014-05-20 浏览次数:20742 次
public class Father {
private String father;
public Father() {
Field fs[] = this.getClass().getDeclaredFields();
for (int i = 0; i < fs.length; i++) {
Field f = fs[i];
System.out.println(f.getType().getName() + " " + f.getName());
}
}
}
public class Son extends Father {
private int age;
private String name;
public Son() {
super();
// TODO Auto-generated constructor stub
}
}
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Son son = new Son();
}
}