Page 1 of 1

About Question com.enthuware.ets.scjp.v6.2.484 :

Posted: Sat Apr 09, 2011 6:50 am
by Francisco J. Bermejo
As the sentence threadcounter++; is not atomic and synchronization in run() is not effective (because each thread will get a lock of a different TestClass object) wouldn't be a more correct answer something like this?:
Total of 5 numbers will be printed (some may be repeated or missed) with "N Done" anywhere in the sequence where N cannot be determined.

Re: About Question com.enthuware.ets.scjp.v6.2.484 :

Posted: Sun Apr 10, 2011 5:38 pm
by admin
The given answer is "Numbers 1 to 5 will be printed (some may be repeated or missed) with "N Done" anywhere in the sequence where N cannot be determined." and it is correct because the code can never print any number other than 1 to 5.

"Total of 5 numbers ... " is not one of the options. Had it been an option, it would have been correct as well.