- public class ReflexTest2 {
- //成员方法的反射
- public static void main(String[] args) throws Exception
- {
- Class clazz = null;
- Object obj = new Person();
- clazz = obj.getClass();
- System.out.println(clazz);
- Object object = clazz.newInstance();
- System.out.println(object);//输出哈希值
- }
- }
复制代码 输出是这样的结果:
class Person
Person@1db9742
|
|