Examlex

Solved

Examine the SharedData Class Shown Below

question 65

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. Suppose thread two receives values 1, 2, 3, 4, 5, 6, 7, 8 respectively on its calls. Should we expect the same values for each program run?
Public class SharedData
{
Private int value;
Public void setSharedData(int n)
{
Value = n;
}
Public int getSharedData()
{
Return value;
}
}

Enhance problem-solving skills by writing code snippets and larger programs for specific tasks.
Understand the basic principles and usages of applets in Java.
Learn the structure and syntax of HTML documents.
Recognize the process of embedding Java applets into HTML pages.

Definitions:

Localization of Function

The concept that specific parts of the brain are responsible for specific psychological processes or functions.

Franz Gall

Franz Gall was a neuroanatomist and physiologist known for his development of phrenology, the (now discredited) theory that mental abilities and character traits are determined by the shape of the skull.

William James

An American philosopher and psychologist often referred to as the "Father of American Psychology," known for his contributions to functionalism and pragmatism.

Wilhelm Wundt

considered the father of experimental psychology, he was a German physiologist who established the first psychology laboratory at the University of Leipzig in 1879.

Related Questions