About Question enthuware.ocpjp.v7.2.1466 :
Moderators: Site Manager, fjwalraven
-
- Posts: 125
- Joined: Thu Jul 05, 2018 6:44 pm
- Contact:
About Question enthuware.ocpjp.v7.2.1466 :
The field has a value as soon as the parent constructor finishes, no?
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1466 :
Please read the post above.
-
- Posts: 125
- Joined: Thu Jul 05, 2018 6:44 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1466 :
I did read that. You wrote:
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.That is why, the field has a value even before the constructor is finished.
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1466 :
Still not sure what yout point is. Already mentioned the following in previous post:
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.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.
Who is online
Users browsing this forum: No registered users and 2 guests