Hi there,
First of all I would like to thank you for the great job with OCA/OCP Java SE8 Programmer Practive Tests Book!
I tried the code in Sybex OCA OCP Practice Test online Chapter 19 Q.23 with: "static int count=0;".
And as explained in the answer : If count was marked static, then the application would sum the elements correctly, printing 10. Indeed, it prints 10 correctly.
My question is: Why is it not needed to declare count as Atomic variable?
As more threads are working with count concurrently, I thought it would be necessary in order to keep consistency.
Please help me to understand!
Thanks