posted 15 years ago
When new Derived1() is called we enter the constructor. The Superclass Constructor is called first because the call to it is implicit. The value of the static variable is now 10, then the super constructor returns, and the derived classes constructor finishes running incrementing the static variable by 20 to give you 30.
A harder question would be what is the total if the add value methods are NOT static. ;)