Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Betty Reynolds
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • 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.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic