adplus-dvertising
frame-decoration

Question

Which class or interface defines the wait(), notify(),and notifyAll() methods?

a.

Object

b.

Thread

c.

Runnable

d.

Class

Answer: (a).Object

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Which class or interface defines the wait(), notify(),and notifyAll() methods?

Similar Questions

Discover Related MCQs

Q. What is the name of the method used to start a thread execution?

Q. Which two are valid constructors for Thread?

1. Thread(Runnable r, String name)
2. Thread()
3. Thread(int priority)
4. Thread(Runnable r, ThreadGroup g)
5. Thread(Runnable r, int priority)

Q. Which three are methods of the Object class?

1. notify();
2. notifyAll();
3. isInterrupted();
4. synchronized();
5. interrupt();
6. wait(long msecs);
7. sleep(long msecs);
8. yield();

Q. Which cannot directly cause a thread to stop executing?

Q. Which two can be used to create a new Thread?

1. Extend java.lang.Thread and override the run() method.
2. Extend java.lang.Runnable and override the start() method.
3. Implement java.lang.Thread and implement the run() method.
4. Implement java.lang.Runnable and implement the run() method.
5. Implement java.lang.Thread and implement the start() method.

Q. Which two statements are true?

1. Deadlock will not occur if wait()/notify() is used
2. A thread will resume execution as soon as its sleep duration expires.
3. Synchronization can prevent two objects from being accessed by the same thread.
4. The wait() method is overloaded to accept a duration.
5. The notify() method is overloaded to accept a duration.
6. Both wait() and notify() must be called from a synchronized context.

Q. The following block of code creates a Thread using a Runnable target:

Runnable target = new MyRunnable();
Thread myThread = new Thread(target);

Which of the following classes can be used to create the target, so that the preceding code compiles correctly?

Q. Which statement is true?

Q. Which statement is true?

Q. Which statement is true?