Hi Dmitry,
First of all thank you very much for taking your time to provide the feedback.
(1). IllegalThreadStateException is an unchecked exception - it extends RuntimeException. Therefore, you can use it in the throws part of a method declaration without having any effect and thus the option (G) is correct.
(2). Yes, this is an error and it was identified and corrected long ago with the Beta* release.
(3). It was assumed that the sleep method takes the exact time as the value which was passed as the argument for that method, and all other executions take negligible time for the execution. This type of questions are there in the sun exams - but with an explicit statement which mentions the above assumption. This is in the current Beta update which will be released in next month
(4). Typos happen eveywhere.
(5). Did you try running this program yourself, before you found this as an error?
(6). If you insert "
throw new RuntimeException()", you will get a compile time error, which clearly states why you cannot use it. Please try it out.
(Hint: InterruptedException is a checked exception).
(7).
Dmitry Zhuravlev wrote:both threads aquire s1 lock. why can we state that s1 thread will get it first?
Same reason for question 3.
I appreciate your feedback and thanks again for that. Please let me know if you have any question.
Thanks,
Devaka
*Beta release - you can find it here:
http://examlab.tk/beta