package com.test.thread;


public class TestYield {
	public static void main(String[] args) {
		TestThread t1 = new TestThread("A_01");
		TestThread t2 = new TestThread("B_02");
		t1.start();
		t2.start();
	}
}

class TestThread extends Thread {
	public TestThread(String name) {
		super(name);
	}
	public synchronized void run() {
		for (int i = 0; i < 10; i++) {
			System.out.println(Thread.currentThread().getName());
			//Thread.yield();
		}
		
	}
}


Java多线程____线程yield方法介绍_多线程