Java Bootcamp – Workbooks and Challenges
)}

Global Superstore 7

Prerequisite: You wrote the solution for part 6.

Goal: use Atomic to synchronize multi-threaded updates to a variable.

Task 1


Locks can make your code hard to read. Use atomic variables to enforce thread safety. Your final output should remain:

>>: The sample size is: 1522889

>>: The quantity sold is: 8818065

Final Remarks:

When possible, favor Atomic types over locks. When several threads are updating a variable, Atomic ensures the updates are synchronized.

Good Luck!


Feedback Summary
4.8
38 students
5

92%
4

3%
3

0%
2

0%
1

5%
Written Reviews
There are no written reviews yet.