Thursday, July 28, 2011

[android-developers] Static Initializers - interdependencies

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?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment