package ThreadDemo;
// 线程礼让不一定成功
public class Test13_Yield implements Runnable{
@Override
public void run() {
System.out.println(Thread.currentThread().getName()+".start");
Thread.yield();
System.out.println(Thread.currentThread().getName()+".end");
}
public static void main(String[] args) {
Test13_Yield test13Yield = new Test13_Yield();
new Thread(test13Yield,"a").start();
new Thread(test13Yield,"b").start();
}
}
标签:13,Thread,test13Yield,Yield,start,线程,new,public,礼让
From: https://www.cnblogs.com/zhanjianhai/p/17681116.html