标签:反射
public class Test { private String readOnly; public String getReadOnly() { return readOnly; } public static void main(String[] args) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { Test t = new Test(); Field f = t.getClass().getDeclaredField("readOnly"); f.setAccessible(true); f.set(t, "test"); System.out.println(t.getReadOnly()); } }
本文出自 “一无所有-天行者” 博客,请务必保留此出处http://tianxingzhe.blog.51cto.com/3390077/1696222
标签:反射
原文地址:http://tianxingzhe.blog.51cto.com/3390077/1696222