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();

A. 1, 2, 4
B. 2, 4, 5
C. 1, 2, 6
D. 2, 3, 4


class X implements Runnable 
    public static void main(String args[]) 
        /* Missing code? */
    public void run() {} 
Which of the following line of code is suitable to start a thread ?

A. Thread t = new Thread(X);
B. Thread t = new Thread(X); t.start();
C. X run = new X(); Thread t = new Thread(run); t.start();
D. Thread t = new Thread(); x.run();


Which method must be defined by a class implementing the java.lang.Runnable interface?

A. void run()
B. public void run()
C. public void start()
D. void run(int priority)


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

A. Object
B. Thread
C. Runnable
D. Class


Assume the following method is properly synchronized and called from a thread A on an object B:


After calling this method, when will the thread A become a candidate to get another turn at the CPU?

A. After thread A is notified, or after two seconds.
B. After the lock on B is released, or after two seconds.
C. Two seconds after thread A is notified.
D. Two seconds after lock B is released.