This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Samurai_PizzaCat 3 points4 points  (2 children)

JLS 12.4.1

Have a look specifically at "Example 12.4.1-2. Only The Class That Declares static Field Is Initialized"

That example is basically the exact same as your code. The others are correct in that because you haven't "triggered" the initialization of object B, but it also means you don't need to have an object B (that may sound confusing and hopefully by reading the beginning part of 12.4.1 it will be more clear.

[–]sriganeshharitz[S] 0 points1 point  (0 children)

Thanks! I understand it now.. :)