Can we create an object of the inner class in the constructor of the outer class?
问题 Can we create an object of the inner class in the constructor of the outer class? 回答1: Sure. public class Outer { public Outer() { Inner inner = new Inner(); } class Inner { } } 回答2: Yes it's legal to construct an inner class in constructor of outer class. For example: public class Outer { private Inner myInner; public Outer() { myInner = new Inner(); } public class Inner { } } Have a read through the Sun Nested Classes Tutorial. 回答3: If I understand you correctly, then yes, if your using