Consider the following class with a single field:
class MyClass {
private volatile long number = 5;
public void setNumber(long number) {
this.number = number;
}
public long getNumber() {
return number;
}
}
Thread A and Thread B have access to one instance of the class.
Thread A assigns a new value to the field of the instance.
instance.setNumber(10);
After this event, Thread B reads the value of the instance using the getter:
int number = instance.getNumber();
What value(s) might Thread B read from number?