线程hardy会一直等待下去么?# Java - 爪哇娇娃
q*s
1 楼
代码见下面,为什么?
多谢各位!
public class TwoThreads {
static Thread laurel, hardy;
static final Object[] locker = new Object[0];
public static void main(String[] args) {
laurel = new Thread() {
public void run() {
System.out.println("A");
try {
hardy.sleep(1000);
} catch (Exception e) {
System.out.println("B");
}
System.out.println("C");
}
多谢各位!
public class TwoThreads {
static Thread laurel, hardy;
static final Object[] locker = new Object[0];
public static void main(String[] args) {
laurel = new Thread() {
public void run() {
System.out.println("A");
try {
hardy.sleep(1000);
} catch (Exception e) {
System.out.println("B");
}
System.out.println("C");
}