62,620
社区成员
发帖
与我相关
我的任务
分享
public class InitTest {
private static boolean initialized = false;
private static int initI = 0;
private static Thread t = new Thread(new Runnable() {
public void run() {
System.out.println("1");
initI = 2;
System.out.println(initI);
}
});
static {
t.start();
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
throw new AssertionError(e);
}
System.out.println(initialized);
}
public InitTest() {
System.out.println("Initialization is finished!");
}
public static void main(String[] args) {
new InitTest();
}
}