posted 18 years ago
HI sakthi
By executing the statement new Q05()
(Let see step by step)
step - 1 calls constructor of Q05 class
(every first line in constructor calls to its immediate base class)
step - 2 which in tends call to Just class constructor
step - 3 which in tends call to Object class constructor
step - 4 object class constructor returns
step - 5 method name call() in just class executes call() method in Q05 class
(at that time b only contains default value...so it prints 0)
(Initialize of instance variables takes place only after base class constructor completes)
(derived class method is called because instance is of derived class)
step - 6 Just class constructor returns
step - 7 method name call() in Q05 class constructor executes call() method in Q05 class
(this time given b value is intialized to 16....so it prints 16)
Hope now UR clear