(Initialization of a class consists o executing its static initializers and the initializers or the satic fields(class variables) declared inthe class . Intialization of an interface consists of executing the initializers for fields(constants) declared there.
Before a class i initialized, its superclasses mus tbe initialized, but interfaces implemented b the class are not initialized. Similarly, the superinterfaces of an interface are not initialized before the interface is initialized.)
Originally posted by Animesh Shrivastava:
Only when u need the interface u implement it.
So, why to initialize until we need.
Thats the main intent what i believe.
With Regards,<br />Ajay
The above logic of yours apply to class also... if i am just refering a variable of a class, then intialize only that class.. why unnessary initalize its superclass way to Object class
Originally posted by Ajay Bhargov:
Hi Aruna,
There may be some situation where a method in ur subclass may access a property in your superclass. So for the code to work now all the superclass properties should be initialized.
Originally posted by Animesh Shrivastava:
When u extend any class, the super class's accessible members also become members of the sub class. Thats how u can just invoke any instance method of super class from ur sub class instance method.
Destiny's powerful hand has made the bed of my future. And this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|