标签:port new getc import end student cep tcl 获取
package com.sxt.reflect; import com.sxt.reflect.entity.Student; /* * 获取类的Class信息 */ public class TestReflect { public static void main(String[] args) throws Exception { //方式一 Class.forName() Class<?> clazz = Class.forName("com.sxt.reflect.entity.Student"); System.out.println(clazz.getName()); //方式二 类名.class Class c = Student.class; System.out.println(c); //方式三 对象名.getClass Student stu = new Student(); Class<? extends Student> class1 = stu.getClass(); System.out.println(class1); } }
标签:port new getc import end student cep tcl 获取
原文地址:http://www.cnblogs.com/qingfengzhuimeng/p/6811419.html