Hi,
If Sub class calls the super class constructor. Then if i create the object of subclass then how many object or memory will be created.
suppose ClassA extends ClassB, ClassB extends ClassC, ClassC extends ClassD
i created the object of ClassA(new ClassA()) then how many object will be created.
Hey Mathew.. Thanks..
But i wanted to know if subclass will call the super class constructor by default then how memory created for each constructor...
It will call the superclass constructor, but only to carry out any initialisation that the superclass requires. It doesn't create another object. Constructors don't directly create objects; rather, all the relevant constructors are called when an object is created.
How much memory? It depends on what the superclass constructor does. Possibly none.
There is no beard big enough to make me comfortable enough with my masculinity to wear pink. Tiny ad:
a bit of art, as a gift, that will fit in a stocking