Question: java question!!! Examine the SharedData class shown below. Suppose two threads are created so that each has access to the same SharedData object. Thread one
java question!!!
Examine the SharedData class shown below. Suppose two threads are created so that each has access to the same SharedData object. Thread one calls setSharedData eight times with values 1..8 respectively, sleeping for 30 milliseconds between calls. Thread two calls getsharedData eight times, also sleeping for 30 milliseconds between calls. Which of the following could be the last two values received by thread two? public class SharedData private int value; public void setSharedData(int n) value = n; public int getSharedData() return value; A. 1, 2 B. 9, 10 C. 8,7 D. 4,7
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
