||Understanding the Interplay Between Utility Classes and Static Initialization|
|Subject:||Diversion: explanation for "skipped" subclass initializer|
The thing to remember is that all static code is resolved staticly - in other words, at compile time. When you reference SubClass.staticVar in your program, the Java Compiler searches for "staticVar" in the definition of SubClass first, and then failing that, it searches its ancestors. Ultimately the compiler will generate code to initialize only the class that the static method or field came from. This is why good compilers (like the one in Eclipse) now warn programmers about accesses to static members through anything other than the class that owns the member.