Mu understanding about this problem,when we create new Child(),the control goes to execute the Child class constructor.over there,first statement is always super().So goes to execute Parent() constructor.Over there ,(Object constructor is called first)then we want method() method to execute,so go to the method and printing s value.For the overall execution upto this,we didn�t initialize s value.so s value is printing as null.Upto this ,I am very clear.
I changed the above program as below.
Still s=null value is printing instead of s=parent.What part am I missing here to get?
I think,
String s is overidded in both Parent and Child.But I am not sure,how this overrided variable works here.Please help me.