黑马程序员技术交流社区
标题:
反射访问私有成员变量
[打印本页]
作者:
奋发吧小白
时间:
2014-9-3 21:25
标题:
反射访问私有成员变量
本帖最后由 奋发吧小白 于 2014-9-3 21:30 编辑
package test;
public class ReflectPoint {
private int x;
public int y;
public ReflectPoint(int x, int y) {
super();
this.x = x;
this.y = y;
}
}
复制代码
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.util.*;
public class ReflaectTest {
public static void main(String[] args ) throws Exception {
复制代码
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2