On 28 July 2011 16:45, RLScott <[email protected]> wrote: > > > On Jul 28, 10:26 am, Daniel Drozdzewski <[email protected]> > wrote: >> >> No. >> The static initialisation of class A references class Main. >> This means that initialisation of class A will cause class Main to >> load, which in turn will run its initialisers. > > And what if class Main happens to have static initializers that > reference some class A static variable. Then the references become > circular. How is that resolved? >
Not allowed... http://java.sun.com/docs/books/jls/third_edition/html/execution.html#44557 have a read... There is this paragraph: ' The static initializers and class variable initializers are executed in textual order, and may not refer to class variables declared in the class whose declarations appear textually after the use, even though these class variables are in scope (§8.3.2.3). This restriction is designed to detect, at compile time, most circular or otherwise malformed initializations.' Daniel -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

