Skip to content
CodeKruPro

Thread.sleep() versus wait()

QuizMediumJava onlyAsked in: Accenture, Capgemini, Cognizant, Infosys, TCS

Which statements are true? Pick all that apply.

  • Thread.sleep(ms) pauses the current thread and keeps any locks it holds
  • obj.wait() releases the lock on obj while waiting
  • wait() can be called anywhere without holding the lock
  • Thread.sleep is a good way to wait for a page element

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in