posted 14 years ago First, understand that the instances of Inner and InnerMost share the instance field i with the enclosing instance of Outer. This is true no matter how many Inner or InnerMost instances we create.
Second, realize that whenever a class instantiated, the constructor of its superclass is called.
So first, the instance of Outer is created along with the i instance with a value of zero.
Then, the Inner instance is created. The Inner constructor increments i to 1.
Finally, the InnerMost instance is created, and before any of the commands in its constructor are executed, it calls the superclass constructor.
So i is now incremented twice more: once in the superclass constructor, and another time in the InnerMost constructor.