package com.prj;
public class TestYield {
public static void main(String[] args) {
MyYield myth=new MyYield();
new Thread(myth,"a").start();
new Thread(myth,"b").start();
}
}
class MyYield implements Runnable {
@Override
public void run() {
// TODO Auto-generated method stub
System.out.println(Thread.currentThread().getName()+"线程开始执行");
Thread.yield();
System.out.println(Thread.currentThread().getName()+"线程停止执行");
}
}