不会释放锁的<public class YieldTest {
public static void main(String args[]) {
Test2 a = new Test2();
Thread t = new Thread(a);
Thread t1 = new Thread(a);
t.start();
t1.start();
}
}
class Test2 implements Runnable {
public void run() {
int a=0;
synchronized (this) {
while(a<100){
System.out.println(Thread.currentThread().getName() + "--"+a++);
Thread.yield();
}
}
}
}>