反射简单测试

2016-7-24 流沙 JAVA

package com.gyarmy.person; import java.lang.reflect.Field; import org.junit.Test; public class TestPerson { @Test public void test2() throws Exception{ Class cls1 = Class.forName("com.gyarmy.person.Person"); Field nameField = cls1.getDeclaredField("name"); //打开访问权限 nameFi...

阅读全文>>

标签: 反射

评论(0) 浏览(434)


Powered by 流沙团