Java Reference
In-Depth Information
to initialize a static field, put the block immediately after the field declaration. This enhances clarity
and eliminates the possibility of static initialization competing with a static block, as in the original
program.
In summary, think about class initialization order, especially when it is nontrivial. Do your best
to keep the class initialization sequence simple. Use eager initialization unless you have some good
reason to use lazy initialization, such as performance or the need to break a cycle in initialization.
< Day Day Up >
 
 
Search WWH ::




Custom Search