inner-classes

Static method returning inner class

I really don't understand why the getMyClass2 method below cannot be static, why isn't it valid Java code? public class MyClass { private class MyClass2 { public String s1 = ""; public String s2 = ""; } private MyClass2 myClass2; private static MyClass2 getMyClass2() { MyClass2 myClass2 ...

Defining inner class outside java file.

Hello. I want to create a class, ClassB, as inner class of ClassA, but I want to write down outside ClassA.java file. How can I do this? It will be a lot of inner class, and ClassA.java file will be enormous. UPDATE What I really want to do is define ten classes that they will be only accessible by one class. All of them are defined ...