java反射类main方法

来源:互联网 发布:js中给文本框赋值 编辑:程序博客网 时间:2024/06/06 02:11
<span style="white-space:pre"></span>public void test6() throws Exception{Class clazz = Class.forName("reflect.Person");Method method = clazz.getMethod("main",String[].class);//方法一//method.invoke(null,new Object[]{new String[]{"1","2"}});//方法二method.invoke(null,(Object)new String[]{"1","2"});}

0 0
原创粉丝点击