I have an interface which looks like this:
public interface A {
public interface B {
public static final Cat cat = new Cat("Alice");
}
}
Is there any way I can access the Cat object through reflection?
I have tried this:
Field catField = Class.forName("A.B").getField("cat");
But it gives me a ClassNotFoundException.
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire