• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Thread

 
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you explain generally when a wait() call issued to an object? I thought answer A will be correct.
What is the effect of issuing a wait() method on an object
A) If a notify() method has already been sent to that object then it has no effect
B) The object issuing the call to wait() will halt until another object sends a notify() or notifyAll() method
C) An exception will be raised
D) The object issuing the call to wait() will be automatically synchronized with any other objects using the receiving object.
 
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, B is the closest in terms of being correct, but it's poorly worded. Objects don't wait. Objects are passive things. Threads execute object methods, or more appropriately, each java.lang.Thread object represents a thread of execution in your application.
B should say something like "The thread executing wait() on an object will halt until another thread calls notify() or notifyAll() on that object ( or an InterruptedException is thrown).
reply
    Bookmark Topic Watch Topic
  • New Topic