This will compile properly and will print STP. (tried myself.)
1) The main method creates an instance of OuterTest class. The constructor OuterTest(String
) runs. The "id" instance variable gets the value "STP".
2) The main method creates an instance of InnerTest class.
3) The doSomething() method of inner object runs. Inside doSomething(), the id instance variable's value of the for the outer instance is printed.
The only confusing syntax could be "OuterTest.this.id." The outer object's 'this' reference can be accessed from the inner class using the outerclassname
[ July 26, 2006: Message edited by: Neelesh Bodas ]