• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

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

 
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.
 
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!