raviraj.suddhala
raviraj.suddhala

Reputation: 1

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

What is difference between

thread.sleep(5000);

and

TimerThread.sleep(5000);

in java

Thanks

Upvotes: 0

Views: 1989

Answers (2)

Sai Ye Yan Naing Aye
Sai Ye Yan Naing Aye

Reputation: 6738

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

Upvotes: 0

NPE
NPE

Reputation: 500257

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.

Upvotes: 2

Related Questions