获取字节码文件的三种方式
public class Demo_Reflect {
public static void main(String[] args) throws ClassNotFoundException {
Class class1 = Class.forName("reflect.demo.Test");
Class class2 = Test.class;
Test t = new Test();
Class class3 = t.getClass();
System.out.println(class1 == class2 && class2 == class3);
}
}
网友评论