Examlex

Solved

Examine the SharedData Class Shown Below

question 14

Multiple Choice

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. What is one reason why thread two may not receive 7 and 8 on its two final calls to getSharedData?
Public class SharedData
{
Private int value;
Public void setSharedData(int n)
{
Value = n;
}
Public int getSharedData()
{
Return value;
}
}


Definitions:

Out of Character

Behavior that is not typical for a person, deviating from how they usually act or are expected to behave.

Macular Degeneration

A medical condition that results in blurred or no vision in the center of the visual field due to damage to the macula of the retina.

Central Vision

The section of our vision that is responsible for sharp, detailed, and straight-ahead vision.

Peripheral Vision

The area of visual perception outside the direct line of sight, enabling a broad view of the field around.

Related Questions