I need to write a program that launches 1000 threads. Each thread adds 1 to a variable sum that is initially 0. I need to pass sum by reference to each thread. In order to pass by reference, define an Integer wrapper object to hold the sum. Run the program with and without synchronization to see the effects.
Ex output:
At thread 1 sum = 0;
At thread 2 sum = 1,
Etc…
im lost on how to start..I have some code Ill try to post later
Ex output:
At thread 1 sum = 0;
At thread 2 sum = 1,
Etc…
im lost on how to start..I have some code Ill try to post later
Comment