Class<?> c1 = null;
Class<?> c2 = null;
Class<?> c3 = null;
try{
c1 = Class.forName("com.zju.edu.nio.Demo");
}catch(ClassNotFoundException e){
e.printStackTrace();
}
c2 = new Person("fpc",24).getClass();
c3 = Person.class;
System.out.println("类型:"+c1.getName());
System.out.println("类名:"+c2.getName());
System.out.println("类名:"+c3.getName());
转载于:https://my.oschina.net/liangxiao/blog/126583