Here's another one, which caused similar problems guys? Which statements concerning the methods notify() and notifyAll() are true? 1. Instances of class Thread have a method called notify() 2. A call to the method notify() will wake the thread that currently own the monitor of the object. 3. The method notify() is synchronized 4. The method notifyall() is defined in class Thread 5. When there is more than one thread waiting to obtain the monitor of an object, there is no way to be sure which thread will be notified by the notify() method. I know 3. False 4. False But, I would be interested to hear what you guys think of the other options. Cheers, Brian
Thread (like all objects) extends from Object, and therefore each instance has a notify(), wait() and notifyAll() method, as do any other object. Look at this code: String s = new String(); s.wait(); is completely valid.
I agree with Brain. Answer 1 is correct. Notify and NotifyAll are public methods and subclasses inherit from super.So 1 is correct.
Joined: Nov 04, 2000
No 1 is correct in a sense that Thread extends Object. I was confused because of the way wait() and notify() are used I mean they are used like object instance method ,not like thread instance method.I'll be thankful if someone give more explaination on that.