日期:2014-05-20  浏览次数:20769 次

初学者有关线程的基础问题
Thread.sleep()和Thread.currentThread().sleep()有啥区别?
主要是不明白Thread.sleep()   是让当前线程休眠还是什么意思?

谢谢!

------解决方案--------------------
查api啊
Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds. The thread does not lose ownership of any monitors.

使当前正在执行的线程休眠(暂时停止执行)一段时间.这个线程不会失去监控者的所有权.

和Thread.currentThread().sleep()好像是一个意思.
------解决方案--------------------
是一个意思.
------解决方案--------------------
第二种写法有点多此一举