读书人

菜鸟有关线程的基础有关问题

发布时间: 2012-01-06 22:55:18 作者: rapoo

初学者有关线程的基础问题
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()好像是一个意思.
[解决办法]
是一个意思.
[解决办法]
第二种写法有点多此一举

读书人网 >J2SE开发

热点推荐