OCPJP 6 (83%)
OCPJP 6
OCPJP 6 (83%)
The important thing is not to stop questioning.Curiosity has its own reason for existing.
OCPJP 6 (83%)
If debugging is the process of removing bugs, then programming must be the process of putting them in. -- Edsger Dijkstra
OCPJP 6 (83%)
SCJP
Rohini Sahuji wrote:but for primitives it is not the case.....(forward reference is okay for primitives.....)
SCJP
8.3.2.3 Restrictions on the use of Fields during Initialization
The declaration of a member needs to appear before it is used only if the member is an instance (respectively static) field of a class or interface C and all of the following conditions hold:
The usage occurs in an instance (respectively static) variable initializer of C or in an instance (respectively static) initializer of C.
The usage is not on the left hand side of an assignment.
C is the innermost class or interface enclosing the usage.
A compile-time error occurs if any of the three requirements above are not met.
Andreas Svenkson wrote:
According to JLS as you referenced:
8.3.2.3 Restrictions on the use of Fields during Initialization
The declaration of a member needs to appear before it is used only if the member is an instance (respectively static) field of a class or interface C and all of the following conditions hold:
The usage occurs in an instance (respectively static) variable initializer of C or in an instance (respectively static) initializer of C.
The usage is not on the left hand side of an assignment.
C is the innermost class or interface enclosing the usage.
A compile-time error occurs if any of the three requirements above are not met.
Now what puzzles me is that we are indeed using the reference on the left hand side of an assignment. Compare it with this
Andreas wrote: Now what puzzles me is that we are indeed using the reference on the left hand side of an assignment
OCPJP 6.
In Your Pursuit Towards Certification, NEVER Give Up.
Consider Paul's rocket mass heater. |