Examlex

Solved

Examine the SharedData Class Shown Below

question 64

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:

Accounts Payable

Liabilities or amounts owed by a company to its creditors/vendors for goods and services received but not yet paid for.

Buildings

Structures such as houses, offices, and factories that are constructed as fixed assets for use in operations or investment.

Land

A type of real estate that refers to the earth's surface extending downward to the center of the earth and upward infinitely into space, including all natural resources.

Equipment

Tangible property used in operations, such as machinery and office equipment, which is not intended for sale.

Related Questions