• 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

MindQ's #28 - Another bad (ambiguous) question

 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
28. What exception might a wait() method throw?
The first answer that comes to my mind is IllegalMonitorStateException. The "correct" answer
is InterruptedException.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The signature of wait()in JLS clearly shows that wait()method throws both IllegalMonitorStateException and InterruptedException so IMO both IllegalMonitorStateException and InterruptedException are valid answers.
Regds,
Milind

[This message has been edited by Milind (edited April 02, 2000).]
[This message has been edited by Milind (edited April 02, 2000).]
 
Betty Reynolds
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Right. This is one of those fill in the blank questions. IMO either answer is correct also, but you get penalized if you don't select InterruptedException. A better way to state this question would be to ask what checked exception might
wait() throw.
 
reply
    Bookmark Topic Watch Topic
  • New Topic