D. sleep() is a method called by a thread object; wait() is a method called by a lock object.

The sleep() method is used to pause the execution of the current thread for a specified period of time, and it is called by a thread object. On the other hand, the wait() method is used to pause the execution of a thread until a certain condition is met, and it is called by a lock object. Therefore, option D is the correct statement.

Which of the following statements is correct regarding sleep and waitANone of the above statements are correctBBoth wait and sleep are methods called by thread objectsCwait is a method cal

原文地址: https://www.cveoy.top/t/topic/fn6b 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录