标签:
public class RefDemo {
	
	public static void main(String[] args) throws Exception {
		
		Class clazz = Class.forName("RefDemo");
		Method decMethod = clazz.getDeclaredMethod("print", new Class[]{});
		decMethod.invoke(clazz.newInstance());
	}
	
	public void print(){
		System.out.println("有本事你就调用我啊。");
	}
}
标签:
原文地址:http://www.cnblogs.com/childhooding/p/4541606.html