• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

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).
 
Whatever. Here's a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic