I have a class:
public class MyClass {
private final AnotherClass myField = new AnotherClass() {
@Override
public long getSize() {
...
}
}
I have already got the Class
object of MyClass
:
Class<MyClass> myClazz = LOAD_CLASS("MyClass");
how to use Java reflection to invoke the getSize()
method of myField
defined in MyClass
?