posted 17 years ago
Hi Srinivas,
I think you are getting derailed by:
Notice name is not static. That means you'll have an instance of name for each instance of class A.
After this line executes:
A's name is set to "A0", although counter is post incremented to 1.
When this line runs:
A's constructor is run again, and the new instance of name is set to "A1". After that, the instance of that name dissolves.
The line:
Creates a new instance of B. A's constructor is not called because it is not necessary being that it was called when a1 was created. Here, the original value of name "A0" is used.
The same applies to the next line too.
Hope this helps...
Aloha,
Doug
-- Nothing is impossible if I'mPossible