Type Information The need for RTTI Because it is a dynamically bound method, the proper behavior will occur even though it is called through a generic reference. That's what RTTI means: At run time, the type of an object is identified. You want the b…
对于类A.B,A是B的基类,A有一个私有成员name A.java public class A { private String name = "A"; public void print() { System.out.println(name); } } B.java public class B extends A { } 对于A对象a,要想改变a的name,可以这样操作: try { Field nameFieldInA = a.getClass().getDeclaredFi…