Java multithreading: sleep and currentThread methods

I am new to Java concurrent programming. I noticed that the sleep () and currentThread () methods of the Thread class are static. Since with a multi-core processor many threads can start at the same time, I was wondering how the thread is selected between executable ones. Thank.

+3
source share
1 answer

It is easy to find in Javadocs forThread :

For currentThread():

Returns a reference to the current stream object .

For sleep():

Makes the current executable thread sleep

those. ThreadThat calls the method for both methods.

+1
source

All Articles