Java tutorial
public class Main { public static void main(String[] args) throws Exception { Class cls = Class.forName("MyClass"); Class[] classes = cls.getDeclaredClasses(); for (int i = 0; i < classes.length; i++) { System.out.println("Class = " + classes[i].getName()); } } } class MyClass { public class InnerClass1 { public InnerClass1() { System.out.println("Inner Class1"); } } public class InnerClass2 { public InnerClass2() { System.out.println("Inner Class2"); } } private class InnerPrivateClass { public InnerPrivateClass() { System.out.println("Inner Private Class"); } } }