In Java, the thread that calls Thread.sleep, sleeps! Q: how do you hibernate thread B in thread A?

1. Both An and B threads run simultaneously in an infinite loop.
2.How does thread A let thread B sleep for a while.
3.B Thread continues to loop indefinitely after hibernation.

Mar.17,2021

in A thread, let the object of B thread sleep


in A thread (preferably his run method), call threadB.sleep () with the reference of B thread.

Menu