反射简单测试

流沙 | JAVA | 2016-07-24
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...

阅读全文>>

ė487次浏览 60条评论 0 反射

Ɣ回顶部