标签:
public class ReflectDemo { public static void main(String[] args) throws ClassNotFoundException { Test test = new Test(); Class one = Test.class; Class two = test.getClass(); Class three = Class.forName("reflect.test.Test"); System.out.println(one); System.out.println(two); System.out.println(three); System.out.println(one==two); System.out.println(one==three); System.out.println(three==two); } }
类的加载指的是将类的.class文件中的二进制数据读入到内存中,将其放在运行时数据区的方法区内,然后在堆区创建一个这个类的java.lang.Class对象,用来封装类在方法区类的对象
标签:
原文地址:http://www.cnblogs.com/winAlaugh/p/5349961.html