I am experimenting with Multithreading in java, basically I want to make two threads, and have them count to a number.
But when they reach about half way they sleep for a set amount of time. So I was thinking to put an IF statement within the FOR loop to see when it reached halfway and then if it has, it will put itself to sleep.
I am running a single core cpu atm because I am on a school computer so in theroy, when I put the first thread to sleep, the second one should start?
Also, is it possible to put the first thread to sleep, from the second one and vice versa?