首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

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

2012-01-06 
初学者有关线程的基础问题Thread.sleep()和Thread.currentThread().sleep()有啥区别?主要是不明白Thread.s

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

热点排行