On 28 July 2011 15:51, RLScott <[email protected]> wrote: > What happens if I have two classes, each with some static variables, > and some initializer in one class references a static variable in > another class? > > the beginning of class A: > > public static ByteBuffer audioInByteBuffer = > ByteBuffer.allocateDirect(Main.bytesPerBlock); > > and in the beginning of class Main: > > public static int samplesPerBlock=1024; > > Is it possible for the static initializers of class A to run before > the static initializers of class Main, so that Main.bytesPerBlock is > not defined at the time it is used in the initializer of > audioInByteBuffer?
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. -- Daniel Drozdzewski -- 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

