...
Code Block | ||
---|---|---|
| ||
public class Lazy { private static boolean initialized = false; static { Thread t = new Thread(new Runnable() { public void run() { initialized = true; } ); t.start(); try { t.join(); } catch(InterruptedException ie) { throw new AssertionError(ie); } // Other initialization } public static void main(String[] args) { System.out.println(initialized); } } |
...