Originally posted by Ajith Kallambella:
Since wait throws InterruptedException, a call to wait should [b]either be enclosed in a try-catch block OR the enclosing method should be declared with a throws clause
So, I guess the must be condition is wrong, and so the answer given is incorrect.
Do you agree?
Ajith[/B]
Theoritically this is OK.
But, don't you call wait() to get to some resource that is used in the code right after the wait()? So, isn't it ideal to handle the exception at in a try-catch block right around the wait()? Else, what happens? Control goes back to the caller where the exception could be handled, but I think it is a waste of programming like this. The condition cannot be handled in the caller so that this
thread gets the resource anymore.
Am I making any sense, or Am I all confused and jabbering??
Savithri