Is the following statement correct? (Select one correct answer) I guess not many have been to www.jiris.com. Its good. Try the mock exams there. One of the ? there is ---------------------------------------------- "The notify() and notifyAll() methods can only be called within a synchronized code, otherwise there will be compile error." A: True B: False -------------------------------------------- Ans is false but explaation given says It is not a compile time error, instead it will be a runtime time exception as IllegalMonitorStateException -------------------------------------------- Is the ? worded rightly. Should it not include wait(). Plz clarify Thx
it compiles and gives this output when you run it:
Exception in thread "main" java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.notify(Native Method) at Test.main(Test.java:6)
Francisco
Francisco<br />SCJP<br />please use the [code][/code] tags when showing code.Click <a href="http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=ubb_code_page" target="_blank">here</a> to see an example.