日期:2014-05-20  浏览次数:20692 次

关于反射
使用 “反射” 能否访问到某个类的私有属性,能访问到私有方法么?

------解决方案--------------------
探讨
Java code
public static void main(String[] args){
Test test = new Test();
try {
Method method = Test.class.getMethod("test");
method.setAccessible(true);
method.invoke(test);

} catch (Exception e) {
e.printStackTrace();
}
}

private void test(){
System.out.println("ababc");
}




上面的报异常的!
能否详细指…