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

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
Francisco J. Bermejo

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

Post 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.

admin
Site Admin
Posts: 10043
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: jjoseorione and 23 guests