This question (originally) comes from one of my mock exams, and it includes the following explanation with the answer.
Compilation but runtime error.
At runtime an error indicating java.lang.IllegalMonitorStateException because the wait call is not within synchronized code. Changing the signature of payBill to public synchronized void payBilll would remove the runtime error, causing the program to run and then pause with no output.
Does the explanation look correct, and if so is there something I can do to change the answer to make the explanation more clear? [ December 19, 2005: Message edited by: Marcus Green ]