当前位置: 动力学知识库 > 问答 > 编程问答 >

multithreading - thread.sleep(5000); and TimerThread.sleep(5000); in java

问题描述:

What is difference between

thread.sleep(5000);

and

TimerThread.sleep(5000);

in java

Thanks

网友答案:

If we're talking about this TimerThread, then there is no difference. The two ways to call sleep() resolve to the same method (Thread.sleep()).

I would expect this to be the case for any other reasonable class that extends Thread. However, if in doubt, one can always check the source code for the class in question.

网友答案:

TimerThread extends Thread. So Thread.sleep(5000) and TimerThread.sleep(5000) is not different.

分享给朋友:
您可能感兴趣的文章:
随机阅读: