• 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

Object::wait()....doubt

 
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which of the following statements about the Object::wait() is true
a. A wait method should be enclosed in try/catch block handling interrupted exception.
b. When a running thread executes a wait statement the running thread is paused and another thread starts.The paused thread will resume execution when the other thread finishes.
c. A wait method must be enclosed in a synchronized block or an InterruptedExeption will be thrown.
d. If the current thread does not have the object's monitor before executing a wait statement the InterruptedException will be thrown.
e.A wait method must be enclosed in a synchronized block or an IllegalMonitorStateException will be thrown at Runtime.
Answer- I think ,it shd be a and e.....But not sure
Thanx
 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, i suppose the correct answers are 'a' and 'e'
reply
    Bookmark Topic Watch Topic
  • New Topic