Consider the following class definition.
public class Gadget
{
private static int status = 0;
public Gadget()
{
status = 10;
}
public static void setStatus(int s)
{
status = s;
}
}
The following code segment appears in a method in a class other than Gadget.
Gadget a = new Gadget();
Gadget.setStatus(3);
Gadget b = new Gadget();
Which of the following best describes the behavior of the code segment?
A. The code segment does not compile because the setStatus method should be called on an object of the class Gadget, not on the class itself.
B. The code segment does not compile because the static variable status is not properly initialized.
C. The code segment creates two Gadget objects a and b. The class Gadget's static variable status is set to 10, then to 3, and then back to 10.
D. The code segment creates two Gadget objects a and b. After executing the code segment, the object a has a status value of 3 and the object b has a status value of 3.
E. The code segment creates two Gadget objects a and b. After executing the code segment, the object a has a status value of 3 and the object b has a status value of 10.