Interesting OnJava.com article on side-effects of using static initializers

O’Reilly’s OnJava.com have a great article on their site discussing the side effects of using static initializers in your Classes, and describes how accessing static members if different ways may effect when the static initializers are executed.

I’ve run into a couple of these before, particularly the fact that initializers for static members are executed in the order they appear in the code – this is something you should be aware of if there are dependencies between the static variables and or their initializers.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.