/** * * @author yuxg */ import coreJava.javaFile; import javaClassStudy.Student; import javaClassStudy.Person; public class helloWorld { public static void main(String[] parm){ //reflection //实例一个学生对象 Person p = new Student("yuxg",12); //获取对象的类 Class c1 = p.getClass(); //打印类名、学生的名字 System.out.println("Class Name:" +c1.getName() + " Student Name:" + p.getName()); System.out.println("Field list:" +c1.getFields() ); } }
时间: 2024-10-09 22:27:38