dimanche 10 janvier 2016

Inner class names, reflecion

I want to make array of nested classes. I use:

c = Class.forName(name);
Class[] arrayClasses = c.getDeclaredClasses();

When I want to print arrayClasses[0].getSimpleName() the output is "Class" not "Example1" or "Example2". Why it prints "Class" instead of nested class name?

Test.java

public class Test {

    public String test = "aaaa";
    public int intTest= 100;
    public int abc = 2;

    public class Example1{
        public boolean xyz = true;
    }
    public class Example2{
        public boolean abc = true;
    }
}





Aucun commentaire:

Enregistrer un commentaire