posted 18 years ago
Well, it's usually only necessary to load a class once in a given JVM. So it's possible that executing code will refer to class A, causeing it to be loaded, and then later on the code refers to B, causing it to be loaded. Since A was already loaded (by itself), it will not be reloaded just before B is loaded. So: you can guarantee that a static initializer in A will run sometime before a static initializer in B - but it's hard to say exactly when. (Unless you follow exactly what code is getting executed.) And when A is loaded the first time, you have no real way of knowing if it's getting loaded just because B is getting loaded, or for some other reason. So there's not really an equivalent of getClass() that you can use to figure out what's going on.
[ May 10, 2005: Message edited by: Jim Yingst ]
"I'm not back." - Bill Harding, Twister