I would suggest compiling Mother.java and then you can do this with the Class object of the mother class.
Class c = motherObj.getClass();
Then you can call c.getClasses(). This will return all public inner Classes of Mother.
If you dont have the mother Object and want to do it with the parameter it would look like this:
java InnerClassChecker Mother.class
Then your InnerClassChecker takes the <param> in its main method and calls
Class.forName(<param>) to load the Mother class object.
No, it is possible which define 2 class in 1 file .
just like
public class A {
}
class B {
}
when class B is not a public , it is possible .
And your way is not possible , when I got Mother.java like this
Mother.java
[code]
public class A {
}
class B {
}
[code]
When I compile it , it becomes A.class and B.class , whick class object should I get ? If A.class include a inner class, may be I can check it out ,
but in this case , 2 class in 1 file, It doesn't work . Can you tell me an other way to do it ?