Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

According to the Java Language Specification (JLS), §12.4, "Initialization of Classes and Interfaces" [JLS 2005]:

Initialization of a class consists of executing its static initializers and the initializers for static fields (class variables) declared in the class.

...

The JLS also states in §8.3.2.1, "Initializers for Class Variables" [JLS 2005]

At run time, static variables that are final and that are initialized with compile-time constant values are initialized first.

...

Step 3 of the detailed initialized procedure described in JLS §12.4.2 [JLS 2014] permits implementations to ignore the possibility of such recursive initialization cycles.

...

Bibliography

 

...

Rule 01: Declarations and Initialization (DCL)      Rule 01: Declarations and Initialization (DCL)Image Added      Image Added