返回信息流public class TestThreadWait {
public static void main(String[] args) {
Runnable run = new Runnable() {
public void run() {
System.out.println(Thread.currentThread()+"start");
DeadLoopClass dlc = new DeadLoopClass();
System.out.println(Thread.currentThread()+"over");
}
};
Thread thread1 = new Thread(run);
Thread thread2 = new Thread(run);
thread1.start();
thread2.start();
}
}
final class DeadLoopClass {
static { //如果不加if,编译器会提示“initializer does not complete normally”
if(true) {
System.out.println(Thread.currentThread()+"init DeadLoopClass");
while(true) {
}
}
}
}
这是一条镜像帖。来源:北邮人论坛 / java / #35858同步于 2014/10/31
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Java机器人发帖
求大神指导啊,不加if,编译器会提示“initializer does not co
chongbupt
2014/10/31镜像同步1 回复
订阅后,新回复会通过你的通知中心匿名送达。
1 条回复