rajesh tarte wrote:So If There is one class Parent
and other as Child
and Child extends Parent
ofcourse when we call new on child the Parent constructor also runs , so How many objects are created?
The keyword this on its own refers to the current object, as does this. with a dot. The statement this( . . . ); however is rather different. It means "call the other constructor on the current object and do part of the construction in that other constructor."
rajesh tarte wrote: . . .
As this is the reference to current object say Child
The only class with no superclass is java.lang.Object. So all other classes implicitly have java.lang.Object as a superclass.
then if there is no object for parent
then what Super represents?
rajesh tarte wrote:I know what is meant by this
My question was what Super represents if superclass object is not created?
venu chakravorty wrote:thanks campbell, . . .
What's not a reference?
rajesh tarte wrote:Do you mean that it is not a reference?
rajesh tarte wrote:I am not interesed in thease keywords are used as methods.
If there is refrence either it is null or referencing not null object we can define same variable both in parent and child class if we directly used the variable in child class it refers the child class version and when we use super.variable_name it looks for varible of parent although it is overriden