Computer Science, asked by nurAnsarui8617, 1 year ago

Which of the following are methods of the Thread class?
1) yield()
2) sleep(long msec)
3) go()
4) stop()
A.1 , 2 and 4
B.1 and 3
C.3 only
D.None of the above

Answers

Answered by piu29587
2
the answer is option B
Answered by adventureisland
0

Option (1) is correct.

yield() and sleep(long msec) and stop() are methods of the Thread class.

About thread class methods :

  • The yield() method is a static method of the Thread class that can stop the current thread and give other waiting threads of the same priority a chance.
  • Calling the stop() function of the Thread class in Java whenever we want to stop a thread from operating. This procedure terminates a running thread, removes it from the waiting threads pool, and collects garbage for it.

Similar questions