Page 1 of 1

About Question enthuware.ocpjp.v7.2.1466 :

Posted: Thu Jul 26, 2018 8:21 pm
by __JJ__
The field has a value as soon as the parent constructor finishes, no?

Re: About Question enthuware.ocpjp.v7.2.1466 :

Posted: Thu Jul 26, 2018 9:39 pm
by admin
Please read the post above.

Re: About Question enthuware.ocpjp.v7.2.1466 :

Posted: Sun Jul 29, 2018 6:38 am
by __JJ__
I did read that. You wrote:
That is why, the field has a value even before the constructor is finished.
My point is that it has a value before "before the end of the constructor;" it has a value after the first line of the constructor, or actually, if you don't explicitly call super(), then it has a value ON the first line of the constructor.

Re: About Question enthuware.ocpjp.v7.2.1466 :

Posted: Sun Jul 29, 2018 7:37 am
by admin
Still not sure what yout point is. Already mentioned the following in previous post:
You should remember that all instance fields get their default values first, even before the constructor runs. These default values are 0 for numeric types, false for boolean, and null for reference types.
Not sure what is the confusion. It doesn't matter where there is a call to super construtor or not. The fields always have a well definedand known value.