Java多线程学习笔记(三)休眠(sleep),让步(yield),插队(join)线程休眠:线程让步:线程插队:
线程休眠:使用Thread.sleep(long millis)可以使线程休眠,也就是将正在执行的线程暂停,将CPU让给其他线程去执行。实例:public class Example06 { public static void main(String[] args) { SleepThread sleepThread = new SleepThread(); new Thread(sleepThread,"线程A