Which class or interface defines the wait(), notify(), and notifyAll() methods?
- Object
Practice related MCQ quizzes and improve step by step.
Which class or interface defines the wait(), notify(), and notifyAll() methods?
Which of the following will not directly cause a thread to stop?
notify()Assume the following method is properly synchronized and called from a thread A on an object B:
wait(2000);
After calling this method, when will the thread A become a candidate to get another turn at the CPU?
Which method registers a thread in a thread scheduler?
start();Which will contain the body of the thread?
run();Which method must be defined by a class implementing the java.lang.Runnable interface?
public void run()Which of the following will directly stop the execution of a Thread?
wait()Which three guarantee that a thread will leave the running state?
wait()sleep(1000)aLiveThread.join()Which two of the following methods are defined in class Thread?
start()run()
Which cannot directly cause a thread to stop executing?
Which three are methods of the Object class?
notify();notifyAll();wait(long msecs);Which two are valid constructors for Thread?
Thread(Runnable r, String name)Thread()What is the name of the method used to start a thread execution?
start();